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:对于数据1000000000 1888888888 147237 749234 1999999999

Posted by 03284 at 2004-07-07 11:14:09 on Problem 1061
In Reply To:Re:对于数据1000000000 1888888888 147237 749234 1999999999 Posted by:rush at 2003-10-24 09:07:07
结果是对的吗?
这个数据的结果我也是这样的,但我提交的不被接受
#include <iostream.h>
void main()
{
	long int x,y,m,n,l,i;
	cin>>x>>y>>m>>n>>l;
	long int k,j=0;
	if(m>n){
		k=y-x;
		for(i=0;i<=m-n;i++){
			
			if(k>0){j+=k/(m-n);k=k%(m-n);}
			if(k==0){
				cout<<j<<endl;
				break;
			}
			k=(l+k);
		}
		if(i>m-n)cout<<"Impossible"<<endl;
	}
	else{
		k=x-y;
		for(i=0;i<=n-m;i++){
			if(k>0){j+=k/(n-m);k=k%(n-m);}
			if(k==0){
				cout<<j<<endl;
				break;
			}
			k=(l+k);
		}
		if(i>n-m)cout<<"Impossible"<<endl;
	}
}

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