POJ 1006 Biorhythms
2015-08-30 11:56
369 查看
问题描述:http://poj.org/problem?id=1006
注意一下,此题可能会无限WA
#include <iostream>
using namespace std;
int p, e, i, d, t, n=0;
int main()
{
while (cin>>p>>e>>i>>d, p!=-1){
for (n++,t=d+1; t<=d+21252; t++)
if ((t-p)%23==0 && (t-e)%28==0 && (t-i)%33==0) break;
printf("Case %d: the next triple peak occurs in %d days.\n", n, t-d);
}
return 0;
}目前只能这样过,我写的别的方法都WA
注意一下,此题可能会无限WA
#include <iostream>
using namespace std;
int p, e, i, d, t, n=0;
int main()
{
while (cin>>p>>e>>i>>d, p!=-1){
for (n++,t=d+1; t<=d+21252; t++)
if ((t-p)%23==0 && (t-e)%28==0 && (t-i)%33==0) break;
printf("Case %d: the next triple peak occurs in %d days.\n", n, t-d);
}
return 0;
}目前只能这样过,我写的别的方法都WA
![](http://static.blog.csdn.net/xheditor/xheditor_emot/default/wail.gif)
相关文章推荐
- POJ ACM 1001
- POJ ACM 1002
- POJ 2635 The Embarrassed Cryptographe
- POJ 3292 Semi-prime H-numbers
- POJ 2773 HAPPY 2006
- POJ 3090 Visible Lattice Points
- POJ-2409-Let it Bead&&NYOJ-280-LK的项链
- POJ-1695-Magazine Delivery-dp
- POJ1523 SPF dfs
- POJ-1001 求高精度幂-大数乘法系列
- POJ-1003 Hangover
- POJ-1004 Financial Management
- 用单调栈解决最大连续矩形面积问题
- 2632 Crashing Robots的解决方法
- 1573 Robot Motion (简单题)
- POJ 1200 Crazy Search(简单哈希)
- 【高手回避】poj3268,一道很水的dijkstra算法题
- POJ 1088 滑雪
- poj2387 Til the Cows Come Home—Dijkstra模板
- poj 2485 Highways