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:O(1)算法(中国剩余定理)In Reply To:O(1)算法(中国剩余定理) Posted by:FOR_RITZ at 2006-11-19 12:02:34 #include<iostream> using namespace std; int main() { int i,p,e,d,w,ci=1; cin>>p>>e>>i>>d; while(p!=-1) { p%=23; e%=28; i%=33; w=(5544*p+14421*e+1288*i)%21252; if(w<=d) w+=(21252-d); else w-=d; printf("Case %d: the next triple peak occurs in %d days.\n",ci++,w); cin>>p>>e>>i>>d; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator