| ||||||||||
| 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 | |||||||||
我再三考虑过后,仍是不对?#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator