#pragma warning(disable:4786)
#include<iostream>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<time.h>
#include<stdlib.h>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<ctime>
#include<string.h>
using namespace std;
#define pi acos(-1.0)
//#define LL __int64
typedef long long LL;
#define INF 0x7fffffffffffffff
#define bug puts("hear!")
#define inf 0x7fffffff
#define eps 1e-10
#define FRE freopen("in.txt","r",stdin)
#define E exp(1.0)
#define mod 1000000007
int gcd( int x, int y )
{
return y==0?x:gcd(y,x%y);
}
int lcm( int x, int y )
{
return x / gcd( x, y ) * y;
}
int main()
{
int T;
scanf( "%d", &T );
while( T-- )
{
int a, b, c, d, rx, ry;
scanf( "%d/%d", &a, &b );
scanf( "%d/%d", &c, &d );
int t = gcd( a, b );
a /= t, b /= t;
t = gcd( c, d );
c /= t, d /= t;
if( gcd( b, d ) == 1 )
printf( "%d\n", lcm( a, c ) );
else
printf( "%d/%d\n", lcm( a, c ), gcd( b, d ) );
}
return 0;
}
怎么看都不像难度是3的题目......................
HDU1713--相遇周期 HDU(110)
最新推荐文章于 2020-03-20 23:05:17 发布