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

我再三考虑过后,仍是不对?

Posted by tcxgsy at 2005-08-19 16:34:34 on Problem 2590
#include"stdio.h"
#include"math.h"

main()
{int n;
 long x,y,z,k,j=0,p=0;
    scanf("%d",&n);
    while(n)
    {   scanf("%d%d",&x,&y);
       z=y-x;k=0;
       for(p=1;;p++)  
          {  k+=p;    //k为什么是乱码呢
              j++;
              if(z<=(2*k))  break;
           }
       if(z<=(2*k-j)) printf("%d\n",(2*j-1));
          else printf("%d\n",2*j);        
        n--;
      }
 }

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