結果
問題 |
No.10 +か×か
|
ユーザー |
|
提出日時 | 2020-10-10 11:36:10 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 813 bytes |
コンパイル時間 | 103 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 20,608 KB |
最終ジャッジ日時 | 2024-07-20 15:51:06 |
合計ジャッジ時間 | 7,588 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 TLE * 1 -- * 7 |
ソースコード
def calculate(count, num, gross, op): if op == '+': if num + gross >= 100001: return dp[num + gross] = dp[gross] + '+' gross += num else: if num * gross >= 100001: return dp[num * gross] = dp[gross] + '*' gross *= num if count >= N - 1: return if dp[total] == '' or len(dp[total]) < N - 1: calculate(count + 1, nums[count + 1], gross, '+') if dp[total] == '' or len(dp[total]) < N - 1: calculate(count + 1, nums[count + 1], gross, '*') N = int(input()) total = int(input()) nums = list(map(int, input().split())) dp = ['' for i in range(100001)] calculate(1, nums[1], nums[0], '+') if dp[total] == '' or len(dp[total]) < N - 1: calculate(1, nums[1], nums[0], '*') print(dp[total])