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 pkueducn1 at 2005-01-10 22:03:03 on Problem 1844
In Reply To:帮我看看错哪儿了吧,谢谢了!这题好像很简单,花不了您多少时间的! Posted by:pkueducn1 at 2005-01-10 21:59:44
> #include<stdio.h>
> void main(){
> 	long m,sum=0,i,t;
> 	scanf("%d",&m);
> 	for(i=1;;i++){
> 		sum+=i;
> 		if(sum>=m) break;
> 	}
> 	if(sum==m) t=i;
> 	else{
> 		if((sum-m)%2) t=i+2;
> 		else  t=i;
> 	}
> 	printf("%d\n",t);
> }

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