結果

問題 No.5 数字のブロック
ユーザー koro9korokoro9koro
提出日時 2015-04-18 12:20:45
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 274 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 11,440 KB
実行使用メモリ 15,848 KB
最終ジャッジ日時 2023-09-17 22:42:39
合計ジャッジ時間 35,223 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 84 ms
15,168 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 79 ms
15,168 KB
testcase_21 AC 79 ms
15,060 KB
testcase_22 AC 78 ms
15,288 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 81 ms
15,064 KB
testcase_27 AC 80 ms
15,028 KB
testcase_28 AC 80 ms
14,956 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 83 ms
15,144 KB
testcase_32 AC 81 ms
15,124 KB
testcase_33 AC 80 ms
15,164 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:2: warning: assigned but unused variable - a
Syntax OK

ソースコード

diff #

# 整数の入力
a = gets.to_i
b = gets.to_i
# すべての幅を取得
c = gets.chomp.split(" ").map(&:to_i);
# 出力
c.sort

i = 0
v = 0
n = c.count #配列数を取得

while v < n
	if  c[0...v].inject(0){|result,i|result+i} <= b

	i += 1
	end

v += 1
end  



print(v)
0