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: x++;y--;这么快就处理吗?if(y<x||y==x) printf("1\n");没有结果0了.... 2也不见了..

Posted by wsbear at 2006-07-23 14:25:22 on Problem 2590
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:
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