| ||||||||||
| 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>
using namespace std;
struct num {
int a, b, c, d, t;
};
int main() {
int a = 0, b = 0, c = 0, d = 0, f = 0;
num all[300];
while (!(a == -1 && b == -1 && c == -1 && d == -1)) {
cin >> a >> b >> c >> d;
all[f].a = a;
all[f].b = b;
all[f].c = c;
all[f].d = d;
f++;
}
f--;
for (int i = 0; i < f;i++) {
int e = c;
a = all[i].a;
b = all[i].b;
c = all[i].c;
d = all[i].d;
a = a % 23;
b = b % 28;
c = c % 33;
c += 33;
while (!(c % 23 == a && c % 28 == b)) {
c += 33;
}
while (c < d)
c += e;
all[i].t = c - d;
}
for (int i = 0; i < f; i++)
while (all[i].t>21252)
all[i].t -= 21252;
for (int i = 0; i < f; i++)
cout << "Case "<<i+1<<": the next triple peak occurs in "<< all[i].t <<" 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