Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

中国剩余定理 能理解

Posted by Cynical at 2006-11-02 10:25:12 on Problem 1006
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator