标签:
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
#include<iostream> using namespace std; #define ll long long ll gcd(ll x,ll y) { return y?gcd(y,x%y):x; } int main() { ll x,y,z,i,t; while(cin>>x>>y) { if(x==0&&y==0)break; if(x!=0) cin>>t; for(i=1;i<x;i++) { cin>>z; t=t/gcd(t,z)*z; } cout<<t-y<<endl; } return 0; }
标签:
原文地址:http://www.cnblogs.com/jhz033/p/5418213.html