| ||||||||||
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 |
中国剩余定理 能理解In Reply To:555....有谁理解偶TLE的痛苦... Posted by:StarCool at 2006-11-02 10:19:29 > #include <iostream.h> > #include <math.h> > void main() > { > int a[1000],b[1000],c[1000],d[1000],s,n; > n=0; > do{ > n++; > cin>>a[n]>>b[n]>>c[n]>>d[n]; > }while(a[n]>-1); > n=0; > a[0]=0; > while(a[n]>-1){ > n++; > a[n]=a[n]%23; > b[n]=b[n]%28; > c[n]=c[n]%33; > s=0; > do{ > s++; > }while(!((s%23==a[n])&&(s%28==b[n])&&(s%33==c[n]))); > cout<<"Case "<<n<<": the next triple peak occurs in "<<abs(s-d[n])<<" days."<<endl; > } > return; > } > 为什么偶在自己机上测1W个数据也超不了时呢~~ Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator