結果
問題 |
No.10 +か×か
|
ユーザー |
![]() |
提出日時 | 2021-11-02 01:23:54 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 478 bytes |
コンパイル時間 | 81 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 17,700 KB |
最終ジャッジ日時 | 2024-10-10 20:24:32 |
合計ジャッジ時間 | 6,634 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 TLE * 1 -- * 8 |
ソースコード
N=int(input()) T=int(input()) A=list(map(int,input().split())) S=[0,A[0]] for a in A[1:]: S.append(min(S[-1]+a,S[-1]*a)) def calc(i,T): #print(i,T) if i==0: if T==A[0]: return "" else: return -1 if calc(i-1,T-A[i])!=-1: return calc(i-1,T-A[i])+"+" if T%A[i]==0 and T//A[i]>=S[i]: if calc(i-1,T//A[i])!=-1: return calc(i-1,T//A[i])+"*" return -1 print(calc(N-1,T))