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 |
自己编译结果完全对,就是wrong answer#include<stdio.h> #include<math.h> void hot(int *a) { int b[2],t,j=1,i; if(a[2]!=a[6]) { t=a[2]; a[2]*=a[6]; a[0]*=a[6]; a[6]*=t; a[4]*=t; } if(a[3]!=43) { b[0]=a[0]-a[4]; b[1]=a[2]; } else { b[0]=a[0]+a[4]; b[1]=a[2]; } for( i=2;i<=abs(b[0]);i++) { if(b[0]%i==0&&b[1]%i==0) j=i; } b[0]/=j; b[1]/=j; if(b[0]==0||b[0]==b[1]) printf("%d\n",b[0]/b[1]); else printf("%d/%d\n",b[0],b[1]); } int main() { int b[7],i; char c; while(EOF != scanf("%d/%d%c%d/%d", &b[0], &b[2], &c, &b[4],&b[6])) { b[3]=c; hot(b); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator