結果

問題 No.107 モンスター
ユーザー 6soukiti296soukiti29
提出日時 2017-08-23 21:57:37
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 596 bytes
コンパイル時間 3,147 ms
コンパイル使用メモリ 68,824 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-12 14:58:28
合計ジャッジ時間 4,309 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import sequtils,strutils,math,algorithm
var
    N = stdin.readline.parseInt
    A = stdin.readline.split.map(parseInt)
    hp = 100
    maxhp = 100
    flag : array[16, bool]
    cnt : int
A.sort(system.cmp)

var flag2 = true
while cnt < N and flag2:
    flag2 = false
    for i,a in A:
        if flag[i] == false and hp + a > 0:
            if a > 0:
                hp = min(hp + a, maxhp)
            else:
                hp += a
                maxhp += 100
            cnt += 1
            flag[i] = true
            flag2 = true
            break
if cnt == N:
    echo hp
else:
    echo 0
0