#include
using namespace std;
/*辗转相除法,求最大公约数*/
int hcf(int u,int v)
{
int t,r;
if(v>u)
{
t=u;u=v;v=t;
}
while((r=u%v)!=0)
{
u=v;
v=r;
}
return v;
}
/*根据最大公约数求最小公倍数,h应该是最大公约数*/
int lcd(int u,int v,int h)
{
return(u*v/h);
}
int main(int argc, char *argv[])
{
int N, divisor, dividend, i, maxhcf;
cin >> N;
cin >> dividend;
for (i=0 ; i {
cin >> divisor;
maxhcf = hcf(dividend, divisor);
printf("%d/%d\n", dividend/maxhcf, divisor/maxhcf);
}
}
阅读(624) | 评论(0) | 转发(0) |