【HDU】 1788 Chinese remainder theorem again
来源:互联网 发布:剑三丐姐捏脸数据邪魅 编辑:程序博客网 时间:2024/06/08 18:31
Chinese remainder theorem again
题目链接
- Chinese remainder theorem again
题目大意
就是说现在有
求一个最小的n~~
题解
可以化简:
明显可以看出等式右边是
代码
#include <iostream>#include <cstring>#include <cstdio>#define LL long longusing namespace std;LL n,a,m[15];LL lcm;LL gcd(LL a,LL b){ if (b==0) return a; else return gcd(b,a%b);}int main(){ while(scanf("%I64d%I64d",&n,&a),n!=0 || a!=0) { for (int i=0;i<n;i++) scanf("%I64d",&m[i]); lcm=m[0]; for (int i=0;i<n;i++) lcm=lcm/gcd(lcm,m[i])*m[i]; lcm-=a; printf("%I64d\n",lcm); } return 0;}
0 0
- hdu 1788 Chinese remainder theorem again
- Hdu 1788 Chinese remainder theorem again
- HDU 1788 Chinese remainder theorem again 数论
- hdu 1788 Chinese remainder theorem again
- HDU 1788 Chinese remainder theorem again
- hdu 1788 Chinese remainder theorem again(最小公倍数)
- Chinese remainder theorem again(HDU 1788)
- hdu 1788 Chinese remainder theorem again 最小公倍数
- hdu 1788 Chinese remainder theorem again
- 【HDU】 1788 Chinese remainder theorem again
- HDU 1788 Chinese remainder theorem again
- hdu 1788 Chinese remainder theorem again 多个数的最小公倍数
- HDU 1788 Chinese remainder theorem again 中国剩余定理转换
- HDU 1788 Chinese remainder theorem again 中国剩余定理
- HDU 1788——Chinese remainder theorem again
- hdu 1788 Chinese remainder theorem again((数学:简单题)
- 【数论】 HDOJ 1788 Chinese remainder theorem again
- HDOJ-1788 Chinese remainder theorem again(数论)
- 高德地图提示com.autonavi.amap.mapcore.MapCore.nativeNewInstance问题
- 处理问题的思路,基于easyui
- leetcode 263. Ugly Number
- ButterKnife8.0.2的使用例程
- 数据库(一)
- 【HDU】 1788 Chinese remainder theorem again
- ipython需要2.7版本python, 手动编译; 解决yum在升级python2.7版本后的功能恢复; 解决pip命令失败问题.
- Android Studio Gradle 多渠道,多appkey签名打包
- Mina通信粘包处理
- C# 转换
- CentOS7区域设置
- 源码分析之Fresco
- 使用sqlyog远程连接mysql错误2003 cant connect to mysql 解决办法
- ZigBee 组,组表与场景