結果

問題 No.161 制限ジャンケン
ユーザー e-mone-mon
提出日時 2015-03-06 00:03:55
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 17 ms / 5,000 ms
コード長 697 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 10,928 KB
実行使用メモリ 7,944 KB
最終ジャッジ日時 2023-08-20 04:22:40
合計ジャッジ時間 1,415 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,792 KB
testcase_01 AC 17 ms
7,780 KB
testcase_02 AC 16 ms
7,768 KB
testcase_03 AC 16 ms
7,796 KB
testcase_04 AC 16 ms
7,944 KB
testcase_05 AC 16 ms
7,708 KB
testcase_06 AC 16 ms
7,828 KB
testcase_07 AC 17 ms
7,924 KB
testcase_08 AC 16 ms
7,928 KB
testcase_09 AC 16 ms
7,804 KB
testcase_10 AC 17 ms
7,796 KB
testcase_11 AC 16 ms
7,868 KB
testcase_12 AC 16 ms
7,800 KB
testcase_13 AC 16 ms
7,848 KB
testcase_14 AC 15 ms
7,788 KB
testcase_15 AC 15 ms
7,768 KB
testcase_16 AC 15 ms
7,936 KB
testcase_17 AC 16 ms
7,784 KB
testcase_18 AC 15 ms
7,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

hand_num = list(map(int,input().split()))

S = sorted(input())
friend = [S.count('G'),S.count('C'),S.count('P')]
point = 0

#win
for i in range(3):
    if hand_num[i] > friend[(i+1)%3]:
        point += friend[(i+1)%3] * 3

        hand_num[i] -= friend[(i+1)%3]
        friend[(i+1)%3] = 0
    else:
        point += hand_num[i] * 3

        friend[(i+1)%3] -= hand_num[i]
        hand_num[i] = 0

#draw
for i in range(3):
    if hand_num[i] > friend[i]:
        point += friend[i]

        hand_num[i] -= friend[i]
        friend[i] = 0
    else:
        point += hand_num[i]

        friend[i] -= hand_num[i]
        hand_num[i] = 0

print(point)
0