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 zsl2007 at 2005-12-31 13:47:35 on Problem 1844
#include<stdio.h>
int main()
{  
   int s,i,sum=0;
   scanf("%d",&s); 
	for(i=1;;i++)
	 {        sum+=i;
		 if(sum-s==0) break;	
		 else  if((sum-s)%2==0)
		         if((sum-s)/2<=sum&&(sum-s)/2>=1) break;
          }
	printf("%d\n",i);	 
}

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