結果
問題 | No.161 制限ジャンケン |
ユーザー |
![]() |
提出日時 | 2015-05-05 04:29:13 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 41 ms / 5,000 ms |
コード長 | 839 bytes |
コンパイル時間 | 90 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,904 KB |
最終ジャッジ日時 | 2024-11-30 04:33:40 |
合計ジャッジ時間 | 1,620 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
ソースコード
import sys#sys.setrecursionlimit(n)import heapqimport reimport bisectimport randomimport mathimport itertoolsfrom collections import defaultdict, dequefrom copy import deepcopyfrom decimal import *g,c,p = list(map(int, input().split()))e = deque((map(str, input())))eg = e.count('G')ec = e.count('C')ep = e.count('P')ans = 0for i in e:if eg > 0 and p > 0:eg -= 1p -= 1ans += 3elif ec > 0 and g > 0:ec -= 1g -= 1ans += 3elif ep > 0 and c > 0:ep -= 1c -= 1ans += 3elif eg > 0 and g > 0:eg -= 1g -= 1ans += 1elif ec > 0 and c > 0:ec -= 1c -= 1ans += 1elif ep > 0 and p > 0:ep -= 1p -= 1ans += 1else:breakprint(ans)