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

这个程序老是WR,请大虾们指点迷津!!!!!!

Posted by 904013041 at 2004-12-14 12:31:57 on Problem 1061
#include <stdio.h>
void main(){
	long int x,y,n,m,L;
	scanf("%d %d %d %d",&x,&y,&m,&n,&L);
    if(n==m) printf("Impossible");
    else if(x>y){
		  if(n>m){
			  if((x-y)%(n-m)!=0)
                    printf("Impossible");
			  else printf("%d\n",(x-y)/(n-m));
		  }
		  else if((L-(x-y))%(m-n)!=0) printf("Impossible");
		       else printf("%d",(L-(x-y))/(m-n));
	   }
	   else if(m>n){
			   if((y-x)%(m-n)!=0)
                    printf("Impossible");
			   else printf("%d\n",(y-x)/(m-n));
		   }
		   else if((L-(y-x))%(n-m)!=0) printf("Impossible");
		        else printf("%d",(L-(y-x))/(n-m));
	   
}





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