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

请教牛人们觉得没错,为什么会WA呢????????????????????

Posted by jiabiao at 2005-08-17 23:22:36 on Problem 2590
#include<stdio.h>
void main()
{
  long x,y,i,n,m,sum,data,count;
  scanf("%ld",&n);
  for(i=0;i<n;i++)
  {
     scanf("%ld %ld",&x,&y);
     x++;y--;
     m=y-x;
     data=2;sum=x;count=2;
     while(sum<y)
     {
       if(sum+data>=y)
       {
         printf("%ld\n",++count);
         break;
       }
       if(sum+data<y)
       {
         sum=sum+data;
         data++;count++;
       }
     }
  }
}


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