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".