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 |
这个程序老是WR,请大虾们指点迷津!!!!!!#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator