結果

問題 No.10 +か×か
ユーザー titiatitia
提出日時 2021-11-02 01:47:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
MLE  
実行時間 -
コード長 851 bytes
コンパイル時間 126 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 821,328 KB
最終ジャッジ日時 2024-04-19 04:36:22
合計ジャッジ時間 6,649 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,752 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 31 ms
10,752 KB
testcase_03 MLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
T=int(input())
A=list(map(int,input().split()))

last=N//2

ANS=[A[0]]

for i in range(1,last+1):
    NANS=[]
    for ans in ANS:
        NANS.append(ans+A[i])
        NANS.append(ans*A[i])
    ANS=NANS



ANS2=[T]
for i in range(N-1,last,-1):
    NANS2=[]
    for ans in ANS2:
        NANS2.append(ans-A[i])
        if ans%A[i]==0:
            NANS2.append(ans//A[i])
        else:
            NANS2.append(-1)
    ANS2=NANS2


SET=set(ANS2)

for i in range(len(ANS)):
    if ANS[i] in SET:
        for j in range(len(ANS2)):
            if ANS[i]==ANS2[j]:
                S=bin(i)[2:].zfill(N//2)+bin(j)[2:].zfill(N-N//2-1)
                for s in S:
                    if s=="0":
                        print("+",end="")
                    else:
                        print("*",end="")
                exit()
                
0