View Code of Problem 66

#include <cstdio>
#include <algorithm>
#include <iostream>
using namespace std;
typedef long long ll;
int main(){
	ll a,b;
	while(scanf("%lld%lld",&a,&b)!=EOF){
		
		ll max= __gcd(a,b);
		if(a==b){
			printf("1\n");
			continue;
		}
		if(max==1)
			printf("%lld/%lld\n",a,b);
		else
			printf("%lld/%lld\n",a/max,b/max);
	}
}

Double click to view unformatted code.


Back to problem 66