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 90405129 at 2004-12-21 19:48:28 on Problem 2140
#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