当前位置:网站首页>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 代码
边栏推荐
- mysql5.7 installation and deployment - yum installation
- ZZULIOJ 1124: 两个有序数组合并
- Dialogue with Chen Ciliang: Nezha wants to popularize high-end products
- Redis6 (1) - Introduction to NoSQL Database and Installation of Redis
- 面试官:项目中 Dao、Service、Controller、Util、Model 怎么划分的?
- Redis(三)——配置文件详解、发布和订阅、新数据类型
- WebView2 通过 PuppeteerSharp 实现爬取 王者 壁纸 (案例版)
- OneFlow source code parsing: operator instructions executed in a virtual machine
- 首次入选OSDI顶会!腾讯提出超大规模推荐系统的模型低延时更新方案
- 数据库的约束
猜你喜欢

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

商城限时秒杀功能系统

自动化测试及Selenium

开发模式对测试的影响

【微服务架构】微服务与SOA架构(2)

兼容移动和PC的loading加载和toast消息插件

技能大赛训练题:组策略一
![[Concept of Theory of Knowledge]](/img/c1/8dcc19e43f78e999b13c8da1c19f62.png)
[Concept of Theory of Knowledge] "Progress in the Theory of Reason" University of Leuven 2022 latest 220-page doctoral dissertation

Dry goods!ASSANet: Making PointNet++ faster and stronger

MySQL 执行查询流程
随机推荐
Several small projects that I have open sourced over the years
Techches Transformer the join wisdom source the author cao, visual basic model study
Cybersecurity Notes 5 - Digital Signatures
"Chief Engineer" Principal (Principal) engineer's way of training
ESP8266 Tutorial 2 - Burn AT Firmware
ZZULIOJ 1124: Merge two sorted arrays
SQL中的字符串截取函数
关于json转换器缺失的问题,报错内容:No converter found for return value of type
第2章-矩阵及其运算-矩阵运算(2)
HCIP ---- VLAN
首次入选OSDI顶会!腾讯提出超大规模推荐系统的模型低延时更新方案
The usage and difference between getParameter() and getAttribute()
database transaction
String interception function in SQL
runtime-core.esm-bundler.js?d2dd:218 Uncaught TypeError: formRef.value?.validate is not a function
短视频软件开发——平台同质化如何破局
Mobile and PC compatible loading and toast message plugins
2023版揽胜运动曝光,安全、舒适一个不落
态势丨黑客侵扰加剧,靶场为网络安全架设“防御盾”
MySQL executes the query process
