2 100 0 50 50
1/1 0/1 1/3 2/3
北航網絡預選賽
#includeint GCD(int a,int b) { return !b?a:GCD(b,a%b); } int main() { int T; scanf("%d",&T); while(T--) { int a,b,am,an,bm; scanf("%d%d",&a,&b); if(a==0&&b) printf("0/1 1/1\n"); else if(a&&b==0) printf("1/1 0/1\n"); else if(a==0&&b==0) printf("0/1 0/1\n"); else { am=a*(100-b); an=10000-a*b; bm=an-am; printf("%d/%d %d/%d\n",am/GCD(am,an),an/GCD(am,an),bm/GCD(bm,an),an/GCD(bm,an)); } } return 0; }