結果
問題 | No.1046 Fruits Rush |
ユーザー |
![]() |
提出日時 | 2020-09-14 18:01:37 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 94 ms / 2,000 ms |
コード長 | 141 bytes |
コンパイル時間 | 304 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-06-22 00:53:49 |
合計ジャッジ時間 | 2,609 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 |
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n Syntax OK
ソースコード
n,k=gets.split.map(&:to_i) aNs = gets.split.map(&:to_i).sort.reverse puts aNs[0] < 0 ? aNs[0] : aNs[0...k].select{|num| num >= 0 }.inject(:+)