結果

問題 No.4 おもりと天秤
ユーザー mai
提出日時 2016-02-03 01:09:53
言語 Ruby
(3.4.1)
結果
TLE  
実行時間 -
コード長 293 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 17,792 KB
最終ジャッジ日時 2024-09-21 20:06:39
合計ジャッジ時間 7,202 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 TLE * 1 -- * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def cbit(x);x.to_s(2).chars.count("1");end

n=gets.to_i

w=gets.split(" ").map(&:to_i).sort!
s=w.inject(:+)

if s%2==1;puts "impossible";exit;end
if s/2<w[-1];puts "impossible";exit;end

(1..n).each{|i|w.combination(i).each{|c|if c.inject(:+)==s/2;puts "possible";exit;end}}

puts "impossible"
0