結果

問題 No.133 カードゲーム
ユーザー はむ吉🐹はむ吉🐹
提出日時 2018-03-25 18:47:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 247 ms / 5,000 ms
コード長 699 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 10,880 KB
実行使用メモリ 10,492 KB
最終ジャッジ日時 2023-09-07 12:00:07
合計ジャッジ時間 6,733 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 170 ms
10,468 KB
testcase_01 AC 169 ms
10,468 KB
testcase_02 AC 171 ms
10,372 KB
testcase_03 AC 117 ms
10,396 KB
testcase_04 AC 204 ms
10,268 KB
testcase_05 AC 235 ms
10,184 KB
testcase_06 AC 242 ms
10,360 KB
testcase_07 AC 233 ms
10,196 KB
testcase_08 AC 201 ms
10,480 KB
testcase_09 AC 204 ms
10,492 KB
testcase_10 AC 242 ms
10,264 KB
testcase_11 AC 238 ms
10,224 KB
testcase_12 AC 242 ms
10,236 KB
testcase_13 AC 169 ms
10,468 KB
testcase_14 AC 197 ms
10,192 KB
testcase_15 AC 206 ms
10,396 KB
testcase_16 AC 239 ms
10,352 KB
testcase_17 AC 242 ms
10,272 KB
testcase_18 AC 238 ms
10,216 KB
testcase_19 AC 238 ms
10,396 KB
testcase_20 AC 242 ms
10,472 KB
testcase_21 AC 247 ms
10,212 KB
testcase_22 AC 240 ms
10,412 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import random
import statistics

EXP_TIMES = 50000


def judge(pair):
    if pair[0] > pair[1]:
        return 1
    else:
        return 0


def conduct_experiment(n, acs, bcs):
    random.shuffle(acs)
    random.shuffle(bcs)
    w = sum(map(judge, zip(acs, bcs)))
    if w > n - w:
        return 1.0
    else:
        return 0.0


def main(times=EXP_TIMES):
    n = int(input())
    acs = list(map(int, input().split()))
    bcs = list(map(int, input().split()))
    ans = statistics.mean(conduct_experiment(n, acs, bcs)
                          for x in range(times))
    print("{ans:.5f}".format(ans=ans))

if __name__ == "__main__":
    main()
0