結果
問題 |
No.4 おもりと天秤
|
ユーザー |
![]() |
提出日時 | 2017-04-05 08:07:31 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 545 bytes |
コンパイル時間 | 158 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-07-08 10:17:15 |
合計ジャッジ時間 | 1,579 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 2 WA * 1 RE * 20 |
ソースコード
# your code goes here n = input() b = list(int(i) for i in input().split()) b.reverse() N=sum(b) e=1 def sca(e,r,i,ba): if e==0: return 0 elif r-ba[i]==0: e=0 return 0 elif r-ba[i] < 0: return 1*sca(e,r,i+1,ba) elif len(ba)==1: return 1 else: ba=ba.pop(i) print(ba) return 1*sca(e,r-b[i],i,ba) if N/2!=int(N/2): print("impossible") else: N=int(N/2) print(N) if sca(e,N,0,b)==0: print("possible") else: print("impossible")