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 level at 2006-07-27 20:30:59 on Problem 2590
#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:
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