POJ 1006 Biorhythms

一场小眼病,三周没做题了,继续吧,今天起

 

 

、POJ 1006 Biorhythms /*x=p (mod 23) x=e (mod 28) x=i (mod 33) l1=1 (mod 23) l2=1 (mod 28) l3=1 (mod 33) l1=0 (mod 28) l2=0 (mod 23) l3=0 (mod 23) l1=0 (mod 33) l2=0 (mod 33) l3=0 (mod 28) l1=924c1 =1(mod 23) l1=5544 l2=759c2 =1(mod 28) l2=14421 l3=644c3 =1(mod 33) l3=1288 x=(p*5544+14421*e+1288*i)%(23*28*33)=n+d n=(p*5544+14421*e+1288*i-d)%(23*28*33) */ #include<cstdio> #include<cstring> int main() { int p,e,i,d; int cas=1; while(scanf("%d%d%d%d",&p,&e,&i,&d)!=EOF) { int n; if(p==-1&&e==-1&&i==-1&&d==-1) break; n=(p*5544+14421*e+1288*i-d)%(23*28*33); if(n<=0) n+=23*28*33;//由于第一天不算,所以得加上23*28*33 printf("Case %d: the next triple peak occurs in %d days./n",cas++,n); } return 0; }

你可能感兴趣的:(POJ 1006 Biorhythms)