首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

POJ 1006解决方法

2012-04-12 
POJ 1006为什么提交上去老是说Wrong Answer,实例都通过了啊题目地址:http://poj.org/problem?id1006C/C++

POJ 1006
为什么提交上去老是说Wrong Answer,实例都通过了啊
题目地址:http://poj.org/problem?id=1006

C/C++ code
#include <iostream>using namespace std;const int Physical = 23;const int Emotional = 28;const int Intellectual = 33;int main(){    int p, e, i, d;    cin >> p >> e >> i >> d;    int index = 1;    while (p != -1)    {        p += 23;        while (1)        {            while (p > e)                e += Emotional;            while (p < e)                p += Physical;            if (p == e && (e - i) % Intellectual == 0) break;            else if (p == e)                e += Emotional;        }        cout << "Case " << index << ": the next triple peak occurs in " << p - d << " days.";        cin >> p >> e >> i >> d;        index++;    }    return 0;}


[解决办法]
http://apps.hi.baidu.com/share/detail/18920065
楼主参考下这个解题报告,,WA说明算法有问题。。
[解决办法]
1. 你的输出需要加上换行符才行.
2. 多读题, 你用 1 1 1 0 来测试你的程序得到的答案就会不符合要求. 题目要求 "所求的时间小于21252".

热点排行