結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
tookunn_1213
|
| 提出日時 | 2015-08-16 22:07:28 |
| 言語 | Python2 (2.7.18) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 388 bytes |
| コンパイル時間 | 74 ms |
| コンパイル使用メモリ | 6,912 KB |
| 実行使用メモリ | 9,984 KB |
| 最終ジャッジ日時 | 2024-07-18 09:55:07 |
| 合計ジャッジ時間 | 1,198 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 RE * 9 |
ソースコード
import math
N = int(raw_input())
W = map(int,raw_input().split())
sumw = sum(W)
if sumw % 2 == 1:
print 'impossible'
else:
ans = -1
W.sort()
binList = [('{:0'+str(N)+'b}').format(i) for i in range(int(math.pow(2,N)))]
for b in binList:
ssum = sum([W[i] for i in range(N) if b[i] == '1'])
if ssum == sumw / 2:
ans = 0
break
print ('possible' if ans == 0 else 'impossible')
tookunn_1213