标签:描述 bottom spl display ... std define span str
2 1
2 3
0 0
5
分析:表面中国剩余定理。。。
#include <iostream> #include <string> #include <cstdio> #include <cstring> #include <algorithm> #define range(i,a,b) for(int i=a;i<=b;++i) #define rerange(i,a,b) for(int i=a;i>=b;--i) #define LL long long #define CLS(arr) memset(arr,0,sizeof(arr)) using namespace std; LL l,n; LL gcd(LL a,LL b){ return !b?a:gcd(b,a%b); } void solve(){ while(cin>>l>>n,l,n){ LL lcm=1,num; range(i,1,l){ cin>>num; lcm=lcm*num/gcd(lcm,num); } cout<<lcm-n<<endl; } } int main(int argc, char *argv[]){ solve(); return 0; }
HDU 1788: Chinese remainder theorem again
标签:描述 bottom spl display ... std define span str
原文地址:https://www.cnblogs.com/Rhythm-/p/9322648.html