Astronomy POJ - 3101(LCM 和DCD)

poj2069+hud3007(点的最小球(圆)覆盖+模拟淬火算法) Super Star Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 3198   Accepted: 853   Special Judge Description During a voyage of the starship Hakodate-maru (se 阅读详情

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
3
6 2 3
Sample Output
3 1

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.Stack;

public class Main 
{       
    static boolean v[]=new boolean[10005];
    public static void main(String[] args) 
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int a[]=new int[n];
        int u[]=new int[n];
        int d[]=new int[n]; 
        int cnt=0;
        int p;
        for(int i=0;i<n;i++)
        {
            p=sc.nextInt();
            if(!v[p])
            {
                a[cnt++]=p;
                v[p]=true;
            }
        }
        Arrays.sort(a,0,cnt);
        n=cnt;
        int k;
        for(int i=0;i<n-1;i++)
        {
            u[i]=a[i]*a[n-1];
            d[i]=2*(a[n-1]-a[i]);
            k=(int)gcd(u[i],d[i]);
            u[i]/=k;
            d[i]/=k;
        } 
        BigInteger lcm=BigInteger.valueOf(u[0]);
        BigInteger gcdd=BigInteger.valueOf(d[0]);
        BigInteger t=null;
        for(int i=1;i<n-1;i++)
        {
            t=BigInteger.valueOf(u[i]);
            lcm=lcm.multiply(t).divide(lcm.gcd(t));
            gcdd=gcdd.gcd(BigInteger.valueOf(d[i]));
        }
        t=lcm.gcd(gcdd);
        System.out.println(lcm.divide(t)+" "+gcdd.divide(t));
    }
    static long gcd( long x, long y)
    {
        return x%y==0? y:gcd(y,x%y);
    } 
}
电机传动机构的转矩与惯量折算 参考《工业运动控制》 阅读详情

相关推荐

从Zemax到Speos:HUD设计数据无缝迁移避坑指南(含STEP文件精度验证)

本文详细介绍了从Zemax到Speos的HUD设计数据无缝迁移方法,重点解决Zernike曲面参数保真、虚拟厚度设置和坐标系对齐等核心问题。通过STEP文件精度验证和工程化解决方案,帮助工程师避免数据迁移中的常见陷阱,提升HUD系统设计效率。适用于Ansys Zemax和Ansys Speos用户,优化光学性能验证流程。

h6i7j8的博客 1072

POJ 3101 Astronomy(分子最小公倍数+圆周追击)

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 ...

桃夭丶的博客 241

项目回顾一:《高速多端口共享缓存模块》

本帖子仅为了回顾一下一年前自己动手完成的第一个数字ic设计项目的历程,为复试做一下准备,完成的这个sramc模块花了整整四个月的时间,从0到12个模块的代码产出以及模块的验证,虽然没有拿奖,也没有进入复赛,设计过程中使用的技术手段和算法也不太成熟,但这这是一个值得记录的过程!

weixin_60261760的博客 1261

POJ 3101 Astronomy (数学)

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

小坏蛋_千千 1213

SAP CO模块实战:成本中心会计分割结构配置全流程(OKES事务码详解)

本文详细解析了SAP CO模块中成本中心会计分割结构的配置全流程,重点讲解了OKES事务码的实战操作。内容涵盖分割结构的概念理解、配置前的次级成本要素与作业类型主数据准备,并通过步骤拆解演示了如何定义分割结构、规则与版本,以及如何将配置关联到成本中心并执行分割。最后提供了常见问题排查与优化建议,旨在帮助顾问及财务人员掌握成本精确分摊的关键配置,确保期末成本核算的准确性。

embedding5hiker的博客 818

文石NoteX3国行版安装 Google Play经验分享

文石NoteX3国行版安装 Google Play经验分享。

2301_80693261的博客 7660

【POJ3101】Astronomy——分子的最小公倍数

AstronomyTime Limit: 2000MS Memory Limit: 65536KDescriptionThere are n planets in the planetary system of star X. They orbit star X in circular orbits located in the same plane. Their tangent velo

绝尘 1889

dex2oat编译优化调试

dex2oat编译调试的一些技巧和方法

jidapenglin28的专栏 5052

POJ 3101 Astronomy .

题目地址:http://poj.org/problem?id=3101 因为只要半圈就可以在一条直线上,所以可以先求出与第一个星球的差半个周期的时间间隔,求这些分数的公倍数 每个星球的速度是L/Ti , 相差的速度为 abs(L/T0-L/Ti)  那么差半圈的时间为 0.5*L / abs(L/T0-L/Ti) 求分数的公倍数也即是,求分子的最小公倍数,分母的最大公因子 求LCM,GCD

BRCOCOLI的博客 441

深入理解Android音视频同步机制(三)NuPlayer的avsync逻辑

本文深入介绍了NuPlayer的avsync逻辑和原理

张晖的专栏 1万+

【PCB专题】Allegro导出3D文件

Allegro中如何导出3D文件,有没有一键导出操作?

一点硬件 4994

poj 3101 Astronomy(分数的最小公倍数)

http://poj.org/problem?id=3101 大致题意:求n个运动周期不完全相同的天体在一条直线上的周期。 这题我是看着解题报告写的,用到了物理中的角速度什么的。 因为n个天体的周期已知,那么它们的角速度为vi = 2*pi/Ti,若统一选第0个天体为参照物,那么其余天体的相对速度vi' =  2*pi*(T0-Ti)/(T0*Ti)(把周期T相同的

1455

蓝牙调试抓包工具--nRF Connect移动端 使用详细总结

摘要: nRF Connect移动端是一款功能全面的蓝牙低功耗(BLE)调试工具,支持设备扫描、多设备连接、服务/特征值查看及数据读写操作。核心功能包括实时数据通信(读取/写入/通知)、设备固件更新(DFU)以及高级工具如自动化测试和信号分析。兼容Android 4.3+和iOS设备,适用于开发调试(如ESP32/nRF52)、设备管理和数据分析。需注意设备兼容性问题(如旧安卓设备可能需关闭连续扫描),并确保数据类型匹配。配套工具链包括nRF Toolbox和nRF Connect SDK,是BLE开发的必

AIoT深度探索者 | 嵌入式系统架构师 深耕物联网(IoT)与人工智能(AI)融合技术,聚焦​​边缘计算、图像开发、低功耗通信协议​​,致力于智能硬件,关注我获取最新技术文章信息与海量资源~ 2406

POJ 3101 Astronomy (大数+LCM)

Astronomy Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 5167   Accepted: 1127 Description There are n planets in the planetary system of star X. They orbit

Jonariguez 吾本优秀 820

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

POJ - 3101 (Astronomy)

题意:给定 n 个行星的运行周期 T1,T2,...,Tn,求它们两次共线的最短时间间隔; 分析:看输入全是整数,先写了一发整数的最小公倍数(果断WA),设 t1为行星 1 和 2 两次共线的最短时间间隔,则它应该满足 转换一下就变成了 则最终答案应该是 t1~tn-1 的最小公倍数,那么分数的最小公倍数即 分子的最小公倍数 / 分母的最大公约数 ,那分子的最小公倍数肯定存不...

Joker & Liar的博客 318

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

POJ_3101_Astronomy

Astronomy Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 4468   Accepted: 951 Description There are n planets in the planetary system of star X. They orbi

Light_starlight 708

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

3101 Astronomy Java大数,分数的最小公倍数

AstronomyTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 2704 Accepted: 553<br />Description<br />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

kongming_acm的专栏 762

(转)POJ3101 Astronomy【素因子分解】【大数乘法】

Astronomy Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 6107   Accepted: 1382 Description There are n planets in the planetary system of star X. They orb

戴某某 336

POJ 3101 素数分解+大数

题目Astronomy Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 5643 Accepted: 1252 DescriptionThere are n planets in the planetary system of star X. They orbit star X in circular or

仰望天空 475

poj3101——Astronomy(大数数学&gcd)

Astronomy Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 5932   Accepted: 1337 Description There are n planets in the planetary system of star X. They orbit

我在浪里 895

【POJ 3101】Astronomy(GCD+LCM+公式)

【POJ 3101】Astronomy(GCD+LCM+公式) Astronomy Time Limit: 2000MSMemory Limit: 65536KTotal Submissions: 5706Accepted: 1270DescriptionThere are n planets in the planetary system of star X. They orbit star X

ACMer' 1184

POJ 刷题顺序

POJ从简到难(按照AC数目排序)的列表如下,作为小弱的刷题

thestoryofsnow的专栏 31万+

POJ 3103 Astronomy

DescriptionThere 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 pl

so_so_y的博客 752

POJ 3101 Astronomy

Astronomy Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 4700   Accepted: 996 Description There are n planets in the planetary system of star X. They orbit

ACM2272902662的专栏 1128

Almost Identity Permutations CodeForces - 888D (错排公式)

A permutation p of size n is an array such that every integer from 1 to n occurs exactly once in this array.Let’s call a permutation an almost identity permutation iff there exist at least n - k indice

Coldfresh的博客 874
上一篇: Gerald and Giant Chess (CodeForces - 560E)(组合数)
下一篇: Biorhythms POJ - 1006 (中国剩余定理)
coldfresh
博客等级 码龄10年 107粉丝 405原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值