当前位置:网站首页>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 代码
边栏推荐
- CodeChef STMRRG String Merging (dp)
- JWT implements login authentication + Token automatic renewal scheme
- 让软件飞——“X+”技术揭秘
- ISO9001在讲什么?过程方法和风险思维
- LeetCode Algorithm 1721. 交换链表中的节点
- ZZULIOJ 1116 Delete elements [delete]
- owl.carousel poster card Slider carousel switch
- 三相380V整流后的电压
- database transaction
- Network Security Note 6 - Digital Certificates and Public Key Infrastructure
猜你喜欢

1-IMU参数解析以及选择

ISO9001在讲什么?过程方法和风险思维

PPT | 「课件」企业中高层人员安全管理培训(118页)

OneFlow源码解析:算子指令在虚拟机中的执行

Redis (six) - transaction and lock mechanism of Redis6 (unfinished, to be supplemented)
![[C language] Floating point number rounding](/img/ff/3f256deaa5ec82d692828c67cfb0fa.png)
[C language] Floating point number rounding

MongoDB数据库笔记

Array of shell scripts

14 high-frequency handwritten JS interview questions and answers to consolidate your JS foundation

HCIP ---- VLAN
随机推荐
String interception function in SQL
对话陈赐靓:哪吒要让高端产品大众化
[Microservice Architecture] Microservices and SOA Architecture (2)
短视频软件开发——平台同质化如何破局
商城限时秒杀功能系统
【C语言】头文件#include <conio.h>,conio是Console Input/Output(控制台输入输出)
EasyCVR级联时,修改下级平台名称将不同步至上级平台
Research on motion capture system for indoor combined positioning technology
Redis6 (1) - Introduction to NoSQL Database and Installation of Redis
runtime-core.esm-bundler.js?d2dd:218 Uncaught TypeError: formRef.value?.validate is not a function
Codeforces 814 C. An impassioned circulation of affection (dp)
企业如何判断数据治理是否成功?
Mobile and PC compatible loading and toast message plugins
"MySQL Advanced Chapter" 6. Principles of index creation and design
Summary of whitespace, space and escape characters in C language
2022.8.8-----leetcode.761
2022.8.9-----leetcode.1413
「首席工程师」首席(Principal )工程师修炼之道
【C语言】浮点数四舍五入
组合模式:Swift 实现
