結果

問題 No.1835 Generalized Monty Hall Problem
ユーザー 👑 hitonanodehitonanode
提出日時 2021-12-19 15:51:54
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 517 bytes
コンパイル時間 7,596 ms
コンパイル使用メモリ 235,340 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-13 18:47:53
合計ジャッジ時間 7,877 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,352 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,352 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 1 ms
4,352 KB
testcase_14 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// Validator
#include <iostream>
#include <numeric>
#include "testlib.h"

int main(int argc, char **argv) {
    registerValidation(argc, argv);
    int N, M, K;
    N = inf.readInt(3, 1000000);
    inf.readSpace();
    M = inf.readInt(1, N - 2);
    inf.readSpace();
    K = inf.readInt(1, N - M - 1);
    inf.readEoln();
    inf.readEof();

    long long den = 1LL * N * (N - 1 - K), num = 1LL * M * (N - 1);
    auto g = std::gcd(den, num);
    den /= g;
    num /= g;
    std::cout << num << ' ' << den << '\n';
}
0