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:不好意思.

Posted by 20082741 at 2009-12-14 19:23:15 on Problem 1061
In Reply To:不好意思. Posted by:20054959 at 2007-01-17 08:05:21
> 不好意思,修改时不小心提交了.看这个
> 
> #include <stdio.h>
> void main()
> {  unsigned long x,y,m,n,L;
>    scanf("%ld %ld %ld %ld %ld",&x,&y,&m,&n,&L);
>    if (m==n) 
> 	printf("Impossible\n");
>    else
>    	{ 
>         if(m>n)
>         	{m=m-n;
> 		x=(y-x+L)%L;
> 		}
>         else 
> 		{m=n-m;
> 		x=(x-y+L)%L;
> 		}   
>         n=x/m;
> 	x=x%m;
> 	y=x;                       
>         while(1)
>         	{if(y==0) 
> 			{printf("%ld\n",n);
> 			break;
> 			}  
>           	n=n+(y+L)/m;y=(y+L)%m;                           
>           	if(y==x) 
> 			{printf("Impossible\n");
> 			break;
> 			}  
>         	}                                                            
>    	}
> }

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