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 |
Re:请教高手, 还有什么我没考虑到啊?In Reply To:请教高手, 还有什么我没考虑到啊? Posted by:xxxsky1 at 2006-04-07 20:15:49 > #include <iostream> > > using namespace std; > > int main() > { > int p, e, i, d; > int m=0; > while (cin >> p >> e >> i >> d) > { > ++m; > if (p==-1 && e==-1 && i==-1 && d==-1) > { > return 0; > } > int j=0, k; > do > { > k = 23 * j+p; > ++j; > } while ((k-e)%28 || (k-i)%33); > j = k-d; > if (j<=0) > j += 21252; > cout << "Case " << m << ": the next triple peak occurs in " << j << " 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