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

Re:怎么才能不超时???我已经很费力了!!!

Posted by 00430030 at 2004-12-23 13:43:16 on Problem 2140
In Reply To:怎么才能不超时???我已经很费力了!!! Posted by:90405129 at 2004-12-21 19:48:28
> #include<stdio.h>
> #include<math.h>
> int i,j,n,t=0,s;
> void main(){
> 	scanf("%d",&n);
> 	for(i=1;s=i,i<=ceil(n/2);i++){
> 		for(j=i+1;j<=n;j++){
> 			s=s+j;
> 			if(s==n) {t++;break;}
> 			else if(s>n)break;
> 		}
> 	}
> 	printf("%d\n",t+1);
> }
> 苗阿!有时间看一下上面我这个超级算法大程序问题出在那,拜托找出那个超级大错误.........        

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