Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 349 Accepted Submission(s): 113
2 1 2 3 0 0
5/***************************************************** 刚刚开始用int,WA了。。。 换成__int64就AC了 - -|| ******************************************************/ #include <iostream> using namespace std; __int64 gcd(__int64 n,__int64 m) { while (m) { __int64 temp=m; m=n%m; n=temp; } return n; } int main() { __int64 n,m,i,temp,temp1; __int64 a[15]; while (scanf("%I64d%I64d",&n,&m),n+m) { for(i=0;i<n;i++) scanf("%I64d",&a[i]); temp=a[0]; for(i=1;i<n;i++) { temp1=gcd(temp,a[i]); temp=a[i]*temp/temp1; } printf("%I64d/n",temp-m); } return 0; }