pku 1006Biorhythms

作者在 2008-05-06 22:38:59 发布以下内容

http://acm.pku.edu.cn/JudgeOnline/problem?id=1006

这道题是用中国剩余定理写的   直接套用公式了。。。。。

#include <stdio.h>
int main()
{
 int p,e,i,d,a,t=0;
 while(scanf("%d%d%d%d",&p,&e,&i,&d)!=EOF)
 {
  if(p==-1&&e==-1&&i==-1&& d==-1)break;
  a=(5544*p+14421*e+1288*i-d+21252)%21252;
  if(a==0)a=21252;
  printf("Case %d: the next triple peak occurs in %d days.\n",++t,a);
 }
 return 0;
}

ACM | 阅读 2517 次
文章评论,共0条
游客请输入验证码
最新评论