結果
| 問題 |
No.297 カードの数式
|
| コンテスト | |
| ユーザー |
しらっ亭
|
| 提出日時 | 2015-11-07 13:04:14 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 587 bytes |
| コンパイル時間 | 102 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-09-13 13:51:22 |
| 合計ジャッジ時間 | 1,750 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 WA * 7 |
ソースコード
def solve():
N = int(input())
C = input().split()
np = nm = 0
I = []
for c in C:
if c == '+':
np += 1
elif c == '-':
nm += 1
else:
I += c
I.sort()
J = []
for i in range(np + nm):
J.append(int(I[i]))
J.append(int(''.join(I[np + nm:][::-1])))
K = J[::-1]
mi = ma = 0
for i in range(np + 1):
mi += J[i]
ma += K[i]
for i in range(np + 1, np + nm + 1):
mi -= J[i]
ma -= K[i]
print(ma, mi)
if __name__ == '__main__':
solve()
しらっ亭