| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
为什么会错误呢?求大神指教!#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<iomanip>//setiosflags(ios::fixed)<<setprecision(2)
using namespace std;
int main()
{
int a, b, c, d;
vector<int>count;
int pos = 0;
while (cin >> a >> b >> c >> d)
{
if (a == b && b == c && c == d && d == -1)
break;
for (; a > 23 + d; a -= 23);
for (; (a - b) % 28 != 0 || (a - c) % 33 != 0 || a == 0;)
{
a += 23;
}
if (a - d > 21252)
count.push_back((a - d) % 21252);
else
count.push_back(a - d);
pos++;
}
for (int i = 0; i < pos; ++i)
cout << "Case " << i + 1 << ": the next triple peak occurs in " << count[i] << " days." << endl;
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator