結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 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 1 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 WA -
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 2 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,380 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 WA -
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 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

    // 3. T12の通分.
    LL molDenGCDT12 = __gcd(molT12, denT12);
    molT12 /= molDenGCDT12;
    denT12 /= molDenGCDT12;
    // cout << "molT12/denT12=" << molT12 << "/" << denT12 << endl;
    
    // 4. T3 の 調整.
    // posMolP3 が L の倍数なら, 3. で計算終了していると見ることが出来るが,
    // posMolP3 が L の倍数でない場合が出てくるので調整が必要.
    LL molGCDT123 = __gcd(molT12, T3);
    LL molLCMT123 = molT12 / molGCDT123 * T3;
    
    // 5. 分子・分母の通分 ~ 後処理.
    LL molLCM = molLCMT123;
    LL denLCM = denT12;
    cout << molLCM << "/" << denLCM << endl;
    return 0;
    
}
0