結果
問題 | No.10 +か×か |
ユーザー | Kude |
提出日時 | 2020-09-03 09:02:00 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 597 ms / 5,000 ms |
コード長 | 565 bytes |
コンパイル時間 | 436 ms |
コンパイル使用メモリ | 87,284 KB |
実行使用メモリ | 310,352 KB |
最終ジャッジ日時 | 2023-08-21 06:32:05 |
合計ジャッジ時間 | 3,482 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 70 ms
71,236 KB |
testcase_01 | AC | 70 ms
71,112 KB |
testcase_02 | AC | 73 ms
71,240 KB |
testcase_03 | AC | 590 ms
310,352 KB |
testcase_04 | AC | 141 ms
102,032 KB |
testcase_05 | AC | 70 ms
71,288 KB |
testcase_06 | AC | 597 ms
300,240 KB |
testcase_07 | AC | 278 ms
145,672 KB |
testcase_08 | AC | 111 ms
86,464 KB |
testcase_09 | AC | 116 ms
89,832 KB |
testcase_10 | AC | 74 ms
75,620 KB |
testcase_11 | AC | 71 ms
75,412 KB |
ソースコード
n = int(input()) tot = int(input()) a = list(map(int, input().split())) dp = [None] * (tot + 1) dp[a[0]] = '' for x in a[1:]: ndp = [None] * (tot + 1) for i in range(tot + 1): if dp[i] is not None: if i + x <= tot: t = dp[i] + '+' if ndp[i + x] is None or t < ndp[i + x]: ndp[i + x] = t if i * x <= tot: t = dp[i] + ',' if ndp[i * x] is None or t < ndp[i * x]: ndp[i * x] = t dp = ndp print(dp[tot].replace(',', '*'))