HDU1713--相遇周期 HDU(110)
2013-08-15 21:35
459 查看
#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的题目......................
相关文章推荐
- HDU 1713 最小公倍数与最大公约数的问题 相遇周期
- hdu 1713 相遇周期 比较绕的最大公约,最小公倍问题
- HDU 1713 -相遇周期
- HDU 1713 相遇周期
- HDU 1713 相遇周期(水)
- HDU 1713 相遇周期 — 欧几里得算法与最大公约数,最小公倍数
- HDU 1713 相遇周期【这也算数学吗?】
- HDU 1713 相遇周期
- hdu 1713 相遇周期 (GCD & LCM)
- hdu 1713 相遇周期
- HDU 1713 相遇周期(数学 最大公约数与最小公倍数)
- HDU 1713 相遇周期
- HDU-1713 相遇周期
- HDU 1713 相遇周期(求两个分数的最小公倍数)
- HDU 1713 相遇周期
- HDU 1713 相遇周期 (最小公倍数)
- HDU-1713 相遇周期
- hdu1713相遇周期
- HDU 1713相遇周期(两个分数的lcm)
- HDU-1713 相遇周期 LCD LCM