結果

問題 No.356 円周上を回る3つの動点の一致
ユーザー @abcde@abcde
提出日時 2019-03-10 09:47:11
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,364 bytes
コンパイル時間 1,114 ms
コンパイル使用メモリ 143,756 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-05 19:53:03
合計ジャッジ時間 3,340 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

int main() {
    
    // 1. 入力情報取得.
    LL T1, T2, T3;
    cin >> T1 >> T2 >> T3;
    
    // 2. T秒後に一致したとすると, ...
    // -> 3変数は非常に複雑なので, P3 が無いものと見做して考える.
    // -> 相対的な速さとして, P1: L / T1 - L / T3, P2: L / T2 - L / T3 のはず
    // P1, P2 が, どのタイミングで, 一致するかどうかを考えてみる.
    // T12 = (一周分の差)L ÷ (速さの差分)(L / T1 - L / T2)
    // = T1 * T2 / (T2 - T1) 秒後.
    LL molT12 = T1 * T2, denT12 = T2 - T1;
    // cout << molT12 << " " << denT12 << endl;

    // 3. 分母の最小公倍数は?
    LL denGCD = __gcd(denT12, 1LL);
    LL denLCM = (denT12 / denGCD);
    denLCM *= 1LL;
    // cout << "denGCD/denLCM=" << denGCD << "/" << denLCM << endl;
    
    // 4. 分子の最小公倍数は?
    LL molLCMT12 = molT12 * (denLCM / denT12);
    LL molGCD = __gcd(molLCMT12, T3);
    LL molLCM = (molLCMT12 / molGCD);
    molLCM *= T3;
    // cout << "molGCD/molLCM=" << molGCD << "/" << molLCM << endl;
    
    // 5. 分子・分母の通分.
    LL molDenGCD = __gcd(denLCM, molLCM);
    denLCM /= molDenGCD;
    molLCM /= molDenGCD;
    
    // 5. 後処理.
    cout << molLCM << "/" << denLCM << endl;
    return 0;
    
}
0