Cancel fractions by Debanjan

g(a,b){return b?g(b,a%b):a;}main(n,d){for(;~scanf("%d/%d",&n,&d);printf((d/=g(n,d))-1?"%d/%d\n":"%d\n",n/g(n,d),d));}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page