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;
}

posted on 2011-04-05 20:09  宇宙吾心  阅读(146)  评论(0)    收藏  举报

导航