| ||||||||||
| 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:我再三考虑过后,仍是不对?In Reply To:我再三考虑过后,仍是不对? Posted by:tcxgsy at 2005-08-19 16:34:34 #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;
j++;
if(z<=(2*k)) break;
}
if(z<(2*k-j)) printf("%ld\n",(2*j-2));
else
if(z<2*k) printf("%ld\n",2*j-1);
else printf("%ld\n",2*j);
n--;
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator