結果

問題 No.297 カードの数式
ユーザー 👑 rin204rin204
提出日時 2022-07-14 13:11:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 339 bytes
コンパイル時間 831 ms
コンパイル使用メモリ 86,844 KB
実行使用メモリ 71,580 KB
最終ジャッジ日時 2023-09-08 03:09:45
合計ジャッジ時間 3,911 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,224 KB
testcase_01 AC 71 ms
71,568 KB
testcase_02 AC 70 ms
71,092 KB
testcase_03 AC 71 ms
71,524 KB
testcase_04 AC 71 ms
71,164 KB
testcase_05 AC 68 ms
71,372 KB
testcase_06 WA -
testcase_07 AC 70 ms
71,320 KB
testcase_08 AC 69 ms
71,236 KB
testcase_09 AC 69 ms
71,572 KB
testcase_10 AC 70 ms
71,452 KB
testcase_11 AC 69 ms
71,412 KB
testcase_12 AC 68 ms
71,376 KB
testcase_13 AC 70 ms
71,364 KB
testcase_14 AC 70 ms
71,324 KB
testcase_15 AC 68 ms
71,300 KB
testcase_16 AC 68 ms
71,224 KB
testcase_17 AC 70 ms
71,324 KB
testcase_18 AC 70 ms
71,160 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 69 ms
71,300 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
C = input().split()
p = 0
m = 0
A = []
for c in C:
    if c == "+":
        p += 1
    elif c == "-":
        m += 1
    else:
        A.append(int(c))
A.sort()
le = p + m + 1
while len(A) > le:
    a = A.pop()
    A[-1] += 10 * a

tot = sum(A)
ma = tot - 2 * sum(A[:m])
A = A[::-1]
mi = tot - 2 * sum(A[:m])
print(ma, mi)
0