結果
問題 | 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 heapq import re import bisect import random import math import itertools from collections import defaultdict, deque from copy import deepcopy from 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 = 0 for i in e: if eg > 0 and p > 0: eg -= 1 p -= 1 ans += 3 elif ec > 0 and g > 0: ec -= 1 g -= 1 ans += 3 elif ep > 0 and c > 0: ep -= 1 c -= 1 ans += 3 elif eg > 0 and g > 0: eg -= 1 g -= 1 ans += 1 elif ec > 0 and c > 0: ec -= 1 c -= 1 ans += 1 elif ep > 0 and p > 0: ep -= 1 p -= 1 ans += 1 else: break print(ans)