| ||||||||||
| 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<iostream.h>
void main()
{
double s,i,step,m,k,x,y;
cin>>s;
while(s>=1)
{
cin>>x>>y;
m=y-x;i=1;k=0;step=0;
if(m>0)
{
while(k+2*i<=m)
{
k+=2*i;
i++;
step+=2;
}
if(k!=m)
{
if(m-k<=i)
step++;
else step+=2;
}
}
cout<<step<<endl;
s--;
}
}
你和我一样就AC了
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator