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:dynamic at 2003-10-31 21:58:52 谢谢dynamic我这样写的可是还要100多ms 不知道为什么? #include <iostream> using namespace std; int main() { long int p,e,i,d,casei,day,lcm1,lcm2,lcm3; cin>>p>>e>>i>>d; casei=1; lcm1=1288; lcm2=14421; lcm3=5544; while(p!=-1) { day=lcm1*i+lcm2*e+lcm3*p-d; day%=21252; cout<<"Case "<<casei<<": the next triple peak occurs in "<< (day<=0?day+21252:day)<<" days."<<endl; casei++; cin>>p>>e>>i>>d; } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator