Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
超简单,思路很清晰的解法#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator