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 |
WA啊,哪位好心的大哥能指点一下啊!万分感谢!#include<stdio.h> int main() { long n,x,y,i,count,flag; scanf("%ld",&n); for(i=0;i<n;i++) { count=2; flag=2; scanf("%ld %ld",&x,&y); x++;y--; if(y<x||y==x) { printf("1\n"); continue; } while(y>x) { if(x+flag>=y) { count++; break; } if(x+flag<y) { x=x+flag;y=y-flag; count=count+2; flag++; } } printf("%ld\n",count); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator