| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:改了一下,添加了0次的判断In Reply To:改了一下,添加了0次的判断 Posted by:xdzhang at 2009-07-14 12:40:55 > #include <stdio.h>
> void main()
> {
> unsigned long x,y,m,n,l,i,t;
> scanf("%u%u%u%u%u",&x,&y,&m,&n,&l);
> for(i=1;i<=l;i++)
> {
> x%=l;
> y%=l;
> if(x==y)
> {
> printf("%d",0);
> return;
> }
> t=m*i%l-n*i%l;
> if(t<0)
> t+=l;
> if(t==((y>x)?y-x:x-y))
> {
> printf("%d",i);
> return;
> }
> }
> printf("Impossible");
> }
>
题中明确说明了,x!=y。
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator