#include<iostream>#include<cstdio>using namespace std;int main(){int t,p,e,i,d,date;scanf("%d",&t);while(t--){int cas=0;while(~scanf("%d%d%d%d",&p,&e,&i,&d)){if(p==-1)break;date=d;d++;while((d-p)%23!=0) d++;while((d-e)%28!=0||(d-i)%33!=0) d+=23;printf("Case %d: the next triple peak occurs in %d days.n",++cas,d-date);}if(t) puts("");}return 0;}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)