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 TOBENO1 at 2013-10-05 08:55:48 on Problem 2590
#include <iostream>
using namespace std;

int main(){
	int n,i;
	cin>>n;
	for(i=0;i<n;i++){
		double x,y,temp;
		int sum=0,j=1,k,m;
		cin>>x>>y;
		temp=y-x;
		while(1){
			temp-=2*j;
			sum+=2;
			if(temp<=0){
				sum-=2;
				temp+=2*j;
				break;
			}
			j++;
		}
		if(temp-j>0)
			sum+=2;
		else
			sum++;
		if(x==y)
			sum=0;
		cout<<sum<<endl;
	}
    return 0;
}

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