| ||||||||||
| 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 | |||||||||
Re: x++;y--;这么快就处理吗?if(y<x||y==x) printf("1\n");没有结果0了.... 2也不见了..In Reply To:WA啊,哪位好心的大哥能指点一下啊!万分感谢! Posted by:jiabiao at 2006-04-18 13:17:30 > #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