結果
| 問題 |
No.297 カードの数式
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-11-29 15:39:55 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 604 bytes |
| コンパイル時間 | 409 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-09-14 05:04:58 |
| 合計ジャッジ時間 | 2,073 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 WA * 7 |
ソースコード
from itertools import zip_longest
def main():
n = input()
l = input().split()
num = sorted([int(i) for i in l if i.isnumeric()])
ope = sorted([i for i in l if not i.isnumeric()])
nums = [x for x in num[:len(ope)]]
nums.append(int("".join(map(str, sorted(num[len(ope):], reverse=True)))))
max_ans = eval("".join([str(a) + b for a, b in zip_longest(sorted(nums, reverse=True), ope, fillvalue='')]))
min_ans = eval("".join([str(a) + b for a, b in zip_longest(sorted(nums), ope, fillvalue='')]))
print(max_ans, min_ans)
if __name__ == '__main__':
main()