标签:style http io ar color os sp on 数据
2 100 0 50 50
1/1 0/1 1/3 2/3
#include <stdio.h> int 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; }
标签:style http io ar color os sp on 数据
原文地址:http://blog.csdn.net/qq_18062811/article/details/41872955