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 |
求测试数据#include<stdio.h> #include<math.h> int main() { long int x,y,m,n,l,a,b,i,j; scanf("%ld %ld %ld %ld %ld",&x,&y,&m,&n,&l); if((x!=y)&&(x<2000000000)&&(y<2000000000)&&(m>0)&&(n>0)&&(m<2000000000)&&(n<2000000000)&&(l<2100000000)&&(l>0)&&(fabs(x)<l)&&(fabs(y)<l)) { if(x>y) { a=x;b=y;i=m;j=n;} else {a=y;b=x;i=n;j=m;} if(i>j) { if((l-(a-b))%(i-j)==0) printf("%d\n",(l-(a-b))/(i-j)); else printf("Impossible\n");} if(i==j) printf("Impossible\n"); if(i<j) { if((a-b)%(j-i)==0) printf("%d\n",(a-b)/(j-i)); else printf("Impossible\n");} } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator