結果
問題 | No.161 制限ジャンケン |
ユーザー |
|
提出日時 | 2017-08-12 23:13:45 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 33 ms / 5,000 ms |
コード長 | 526 bytes |
コンパイル時間 | 138 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-11-30 05:17:42 |
合計ジャッジ時間 | 1,458 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
ソースコード
# -*- coding: utf-8 -*-G, C, P = map(int, input().split())S = input()g=c=p=0for s in S:if s=='G':g += 1elif s=='C':c += 1else:p += 1score = 0# G,C,Pをまず勝てる方向で費やすscore += 3*(min(G,c)+min(C,p)+min(P,g))temp_G = Gtemp_C = Ctemp_P = PG = max(0, G-c)C = max(0, C-p)P = max(0, P-g)g = max(0, g-temp_P)c = max(0, c-temp_G)p = max(0, p-temp_C)# 残りは出来る限りあいこの方向で費やすscore += min(G,g)+min(C,c)+min(P,p)print(score)