当前位置:网站首页>POJ 3101 Astronomy (数学)
POJ 3101 Astronomy (数学)
2022-08-10 10:33:00 【51CTO】
Description
There are n planets in the planetary system of star X. They orbit star X in circular orbits located in the same plane. Their tangent velocities are constant. Directions of orbiting of all planets are the same.
Sometimes the event happens in this planetary system which is called planet parade. It is the moment when all planets and star X are located on the same straight line.
Your task is to find the length of the time interval between two consecutive planet parades.
Input
The first line of the input file contains n — the number of planets (2 ≤ n ≤ 1 000).
Second line contains n integer numbers ti — the orbiting periods of planets (1 ≤ ti ≤ 10 000). Not all of ti are the same.
Output
Output the answer as a common irreducible fraction, separate numerator and denominator by a space.
Sample Input
Sample Output
题意
给出 n 个行星围绕恒星转动的周期,刚开始所有的行星都在恒星的一侧并且排成一条直线。问最少再经过多长时间所有的行星出现在同一条直线上。
思路
我们先来看两个行星的情况,假设 t 时间之后这两个行星会出现在同一条直线上。
则 2πT0t−2πT1t=πk 其中 k
化简得: 2(T1−T0)tT0T1=k ,为使 k 为最小正整数, t=T0T12(T1−T0)t
对于两个行星以上的情况,可以两两计算得到的 t ,然后求出最小公倍数即可。
分式的最小公倍数求法: (分子分母约分到最简形式)
ab cd:lcm(a,c)gcd(b,d)
AC 代码
边栏推荐
- Mobile and PC compatible loading and toast message plugins
- C#List的使用以及Linq的使用
- owl.carousel海报卡片Slider轮播切换
- 高阶组件使用
- CodeChef STRMRG String Merging (dp)
- runtime-core.esm-bundler.js?d2dd:218 Uncaught TypeError: formRef.value?.validate is not a function
- 动作捕捉系统用于室内组合定位技术研究
- 2022.8.9-----leetcode.1413
- 什么是抽象类
- 网络安全笔记5——数字签名
猜你喜欢

Store limited time seckill function system

4 面拿华为 offer 的水平,面试阿里居然一面就被吊打?

chart.js horizontal column chart plugin

Redis6 (1) - Introduction to NoSQL Database and Installation of Redis

What is an abstract class

8月份DB-Engines 数据库排行榜最新战况

第5章相似矩阵及二次型(4)

Cybersecurity Notes 5 - Digital Signatures

《MySQL高级篇》六、索引的创建与设计原则

跨公网环境,路由策略,进行设备的访问
随机推荐
4 面拿华为 offer 的水平,面试阿里居然一面就被吊打?
[C language] Floating point number rounding
跨公网环境,路由策略,进行设备的访问
bus事件总线 使用
C#List的使用以及Linq的使用
谷歌数据中心发生“电力事故”造成 3 人受伤
解决ASP.NET Core在Task中使用IServiceProvider的问题
第2章-矩阵及其运算-矩阵运算(2)
「第二部:容器和微服务架构」(1) 基于容器应用架构设计原则
runtime-core.esm-bundler.js?d2dd:218 Uncaught TypeError: formRef.value?.validate is not a function
Flutter实战-请求封装(五)之Isolate线程改造
GPU accelerated Pinterest recommendation model, the number of parameters increased by 100 times, and the user activity increased by 16%
Several small projects that I have open sourced over the years
OneFlow source code parsing: operator instructions executed in a virtual machine
14 high-frequency handwritten JS interview questions and answers to consolidate your JS foundation
3D rotating text animation js special effects
What is affecting MySQL performance?
Techches Transformer the join wisdom source the author cao, visual basic model study
「时序数据库」使用cassandra进行时间序列数据扫描
LeetCode Algorithm 1472. 设计浏览器历史记录
