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

不知道为什么,总是WA,各路高手帮忙看看吧!谢谢了啊!

Posted by 90401307 at 2004-12-12 21:42:25 on Problem 1061
#include<stdio.h>
void main(){
	int x,y,m,n,l,a,b,c,i,p,nl,ii;
	scanf("%d",&p);
	for(ii=1;ii<=p;ii++){
		scanf("%d%d%d%d%d",&x,&y,&m,&n,&l);
		a=x+y;
		b=m+n;
		c=a%b;
		if(x==y||x>2000000000||y>2000000000||l>2100000000||m>2000000000||n>2000000000)
			return;
		if(a%b==0){
			nl=a/b;
			printf("%d\n",nl);
		}
		else{
			for(i=2;c!=0&&i<100;i++){
				a+=l;
				c=a%b;
				nl=a/b;
			}
			if(c==0)printf("%d\n",nl);
			else
				printf("Imposible\n");
		}
	}
}


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