HDU1788 水题
来源:互联网 发布:软件无线电原理 编辑:程序博客网 时间:2024/06/08 11:56
本以为是道中国剩余定理的题 结果是一道水题啊 题意就是求最小公倍数然后减去a就可以了
#include <iostream>#include<cstdio>#include<cstring>using namespace std;long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}int main(){ long long i,a,m,ans; while(cin>>i>>a,a+i) { ans=1; for(int j=0; j<i; j++) cin>>m,ans=ans/gcd(ans,m)*m; cout<<ans-a<<endl; } return 0;}
- HDU1788 水题
- HDU1788 Chinese remainder theorem again
- hdu1788 Chinese remainder theorem again
- HDU1788-Chinese remainder theorem again
- hdu1788 中国剩余定理的分析
- HDU1788 Chinese remainder theorem again 最小公倍数
- hdu1788 Chinese remainder theorem again 最小公倍数
- CJOJ 1995 中国剩余定理(HDU1788)
- Chinese remainder theorem again(hdu1788中国剩余定理)
- HDU1788 Chinese remainder theorem again 中国剩余定理
- HDU1788 Chinese remainder theorem again【中国剩余定理】
- HDU1788中国剩余定理—这种奇怪的题目怎么上的杭电
- 水题
- 水题
- 水题
- 水题
- 【水题】
- 水题
- C语言编译的顺序。关于 .c 文件 .h 文件的用法。Makefile文件简单概念。
- 二叉排序树转换成双向链表
- VC调用DLL
- 拓扑排序模板(备忘之用)
- 《C++ Primer》 第02章 [ 变量和基本类型 ]
- HDU1788 水题
- poj 1094 topsort
- AE 遍历栅格实现栅格重分类(C#实现)
- 一些实习体会
- QQ空间动态的问题。
- sql笔记总结
- html中textarea的使用及常见的一个问题解决
- 代码混淆模板
- ConstructorInit.cpp