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

Re:在ZOJ上能过,为什么在POJ上便WA????HELP!!!!

Posted by suibian at 2005-09-10 15:17:58 on Problem 2590
In Reply To:在ZOJ上能过,为什么在POJ上便WA????HELP!!!! Posted by:Tju_Rocket at 2005-08-17 21:00:17
> [code]:
> #include<iostream>
> #include<cmath>
> using namespace std;
> int main()
> {
>  int a,b,step,num,n,n1,step1,step2,num1,num2, V;
**
**  cin>>testcase; //add this line
**
>  while(cin>>a>>b)
>  {
> 	 step=0;
> 	 if(a==b||a==b+1||a==b+2)
> 		cout<<b-a<<endl;
>       else
> 	  {   
> 		  num=b-a;
> 		  n1=int(sqrt(double(num)));
> 		  num1=int(sqrt(double(1+4*num)));
> 		  n=(-1+num1)/2;
> 		  num1=num-n1*n1;
> 		  num2=num-(n+1)*n;
> 		  if(n1>=num1)
> 		  {
> 			  step1=(n1-1)*2+1;
> 			  if(num1)step1++;
> 			  step=step1;
> 		  }
> 		 else if(n>=num2)
> 		  {
> 			  step2=n*2;
> 			  if(num2)step2++;
> 			  step=step2;
> 		  }
> 	
> 		  cout<<step<<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