結果

問題 No.161 制限ジャンケン
ユーザー 6soukiti296soukiti29
提出日時 2017-10-03 00:46:06
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 566 bytes
コンパイル時間 3,009 ms
コンパイル使用メモリ 68,700 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-12 15:15:24
合計ジャッジ時間 3,893 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 26) Warning: imported and not used: 'math' [UnusedImport]

ソースコード

diff #

import sequtils,strutils,math
var
    G, C, P : int
    S : string
    cntg, cntc, cntp, ans : int
(G, C, P) = stdin.readline.split.map(parseInt)
S = stdin.readline
for s in S:
    case s
    of 'C':
        cntc += 1
    of 'G':
        cntg += 1
    of 'P':
        cntp += 1
    else:
        discard

ans += min(C, cntp) * 3
C -= min(C, cntp)
cntp -= min(C, cntp)

ans += min(G, cntc) * 3
G -= min(G, cntc)
cntc -= min(G, cntc)

ans += min(P, cntg) * 3
P -= min(P, cntg)
cntg -= min(P, cntg)

ans += min(C, cntc)
ans += min(G, cntg)
ans += min(P, cntp)

echo ans
0