結果

問題 No.4 おもりと天秤
ユーザー suppy193suppy193
提出日時 2015-06-17 15:46:34
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 287 bytes
コンパイル時間 463 ms
コンパイル使用メモリ 11,520 KB
実行使用メモリ 36,804 KB
最終ジャッジ日時 2023-09-21 09:18:49
合計ジャッジ時間 8,629 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
36,804 KB
testcase_01 AC 79 ms
15,164 KB
testcase_02 AC 88 ms
15,764 KB
testcase_03 AC 77 ms
15,092 KB
testcase_04 AC 80 ms
15,292 KB
testcase_05 AC 125 ms
21,484 KB
testcase_06 AC 77 ms
15,356 KB
testcase_07 AC 78 ms
15,356 KB
testcase_08 AC 77 ms
15,036 KB
testcase_09 AC 77 ms
15,036 KB
testcase_10 AC 79 ms
15,288 KB
testcase_11 AC 79 ms
15,160 KB
testcase_12 AC 79 ms
15,144 KB
testcase_13 AC 79 ms
15,164 KB
testcase_14 AC 79 ms
15,144 KB
testcase_15 AC 77 ms
15,172 KB
testcase_16 AC 77 ms
15,144 KB
testcase_17 AC 77 ms
15,164 KB
testcase_18 TLE -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.chomp.to_i
w = gets.chomp.split(' ').map {|i| i.to_i}
total = w.inject(:+)
if total % 2 == 1
	puts 'impossible'
	exit
end
(n/2).downto(1).each do |i|
	w.combination(i) do |set|
		if total.to_f / 2 - set.inject(:+) == 0
			puts 'possible'
			exit
		end
	end
end
puts 'impossible'
0