就是中国剩余定理的应用……
幸好我学了数学基础
1 #include2 using namespace std; 3 int main(){ 4 int p,e,i,d; 5 int k; 6 int count=1; 7 while(cin>>p>>e>>i>>d){ 8 if(p==-1&&e==-1&&i==-1&&d==-1){ 9 break;10 }11 k=0;12 p=p%23;13 e=e%28;14 i=i%33;15 k=(k+(p*5544))%21252;16 k=(k+(e*14421))%21252;17 k=(k+(i*1288))%21252;18 if(k==0){19 k+=21252;20 }21 if(d==k){22 cout<<"Case "< <<": the next triple peak occurs in "<<21252<<" days."< d){25 cout<<"Case "< <<": the next triple peak occurs in "< <<" days."<