|
#include<bits/stdc++.h>
using namespace std;
int t,s,r=1,m;
int yin(int a,int b)
{
while(r>=0)
{
r=a%b;
if(r==0)
{
break;
}
else
{
a=b;
b=r;
}
}
return b;
}
int main()
{
scanf("%d/%d",&t,&s);
m=yin(t,s);
t=t/m;
s=s/m;
if(s==1)
{
cout<<t;
}
else
cout<<t<<"/"<<s;
} |
|