码迷,mamicode.com
首页 > 其他好文 > 详细

poj 1006 生理周期

时间:2017-04-09 22:32:36      阅读:132      评论:0      收藏:0      [点我收藏+]

标签:namespace   http   mat   .com   include   color   ble   ide   alt   

题目链接: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

 

poj 1006 生理周期

标签:namespace   http   mat   .com   include   color   ble   ide   alt   

原文地址:http://www.cnblogs.com/TreeDream/p/6686789.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!