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 hj19830927 at 2004-08-02 19:54:19 on Problem 1061
#include "stdio.h"
void main()
{
  unsigned long  f,t,x,y,m,n,l,b=1;
  int c=1;
  scanf("%ld%ld%ld%ld%ld",&x,&y,&m,&n,&l);
    f=x+m*b;t=y+n*b;
  if(x==y)  printf("%s","Impossible");
  else{
  do{    if(f==t)
	 {printf("%ld",b); break;}
	 else {
	       if(f>=l)
		 do{f=f-l;
		   }while(f>l);
	       if(t>=l)
		 do{t=t-l;
		   }while(t>l);
		 b++;
		 f=f+m;
		 t=t+n;
	    }
	 if(f>=l)
		 do{f=f-l;
		   }while(f>l);
	 if(t>=l)
		 do{t=t-l;
		   }while(t>l);
	 if(f==x&&t==y)
	   {printf("%s","Impossible");
	      break;}
    }while(c);}
}

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