//目录

poj 1006 生理周期

题目链接:http://poj.org/problem?id=1006

题意:中文题。

中国剩余定理:

 1 #include <cstdio>
 2 #include <cmath>
 3 
 4 using namespace std;
 5 
 6 int main()
 7 {
 8     int p,e,i,d;
 9     int Case=1;
10     int lcd = 21252;
11     while(scanf("%d%d%d%d",&p,&e,&i,&d),p!=-1)
12     {
13         int n = (5544*p+14421*e+1288*i)%lcd;
14         if(n<=d) n+=lcd;
15         printf("Case %d: the next triple peak occurs in %d days.\n",Case,n-d);
16         Case++;
17     }
18     return 0;
19 }
View Code

 

posted @ 2017-04-09 22:27  小草的大树梦  阅读(232)  评论(0编辑  收藏  举报