poj 1006
中国剩余定理。
代码:
#include<iostream>
#include<fstream>
using namespace std;
void read(){
// ifstream cin("in.txt");
int i,j,k,s,t,n=0;
while(cin>>j>>k>>s>>t){
if(j==-1&&k==-1&&s==-1&&t==-1) return;
n++;
i=(5544*j+14421*k+1288*s-t)%21252;
while(i<=0) i+=21252;
cout<<"Case "<<n<<": the next triple peak occurs in "<<i<<" days."<<endl;
}
}
int main(){
read();
return 0;
}
浙公网安备 33010602011771号