結果

問題 No.356 円周上を回る3つの動点の一致
ユーザー finefine
提出日時 2016-04-01 23:40:29
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 755 bytes
コンパイル時間 1,181 ms
コンパイル使用メモリ 159,192 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-10 08:09:36
合計ジャッジ時間 3,601 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 1 ms
6,944 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 WA -
testcase_13 AC 593 ms
6,940 KB
testcase_14 AC 293 ms
6,940 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 WA -
testcase_17 AC 39 ms
6,940 KB
testcase_18 AC 1 ms
6,940 KB
testcase_19 WA -
testcase_20 AC 2 ms
6,944 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 23 ms
6,944 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 9 ms
6,940 KB
testcase_32 AC 9 ms
6,940 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 1 ms
6,944 KB
testcase_38 AC 9 ms
6,940 KB
testcase_39 WA -
testcase_40 AC 2 ms
6,940 KB
testcase_41 AC 13 ms
6,940 KB
testcase_42 AC 3 ms
6,940 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 2 ms
6,944 KB
testcase_48 AC 1 ms
6,944 KB
testcase_49 AC 3 ms
6,944 KB
testcase_50 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int gcd(int m, int n) {
    int r = m % n;
    while (r != 0) {
        m = n;
        n = r;
        r = m % n;
    }
    return n;
}

int lcm(int m, int n) {
    return m / gcd(m,n) * n; 
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c,tmp,x,y,z,tmp2;
    cin >> a >> b >> c;
    tmp = lcm(a, lcm(b,c));
    a = tmp / a;
    b = tmp / b;
    c = tmp / c;
    for(int i = max(a, max(b, c)); i >= 2; i--) {
        x = a % i;
        y = b % i;
        z = c % i;
        if (x == y && y == z) {
            tmp2 = gcd(tmp,i);
            cout << tmp / tmp2 << '/' << i / tmp2 << "\n";
            return 0;
        }
    }
    cout << tmp << '/' << 1 << "\n";
    return 0;
}
0