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 |
改了一下,添加了0次的判断In Reply To:这个程序为何通不过?谁可以帮我举个反例 Posted by:xdzhang at 2009-07-14 12:34:39 #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"); } > return; > } > } > printf("Impossible"); > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator