結果
問題 | No.156 キャンディー・ボックス |
ユーザー |
![]() |
提出日時 | 2015-11-11 00:01:16 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 75 ms / 2,000 ms |
コード長 | 196 bytes |
コンパイル時間 | 60 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,288 KB |
最終ジャッジ日時 | 2024-07-05 15:44:26 |
合計ジャッジ時間 | 3,362 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
コンパイルメッセージ
Main.rb:2: warning: assigned but unused variable - n Syntax OK
ソースコード
str = gets.split n = str[0].to_i m = str[1].to_i c = gets.split.map(&:to_i).sort sum = 0 count = 0 while sum < m do sum += c[count] count += 1 end if sum != m count -= 1 end puts count