結果
問題 |
No.10 +か×か
|
ユーザー |
![]() |
提出日時 | 2021-11-02 01:24:39 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 478 bytes |
コンパイル時間 | 161 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 97,280 KB |
最終ジャッジ日時 | 2024-10-10 20:25:28 |
合計ジャッジ時間 | 6,758 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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))