結果

問題 No.143 豆
ユーザー abinullabinull
提出日時 2021-11-28 17:28:39
言語 Ruby
(3.3.0)
結果
AC  
実行時間 80 ms / 1,000 ms
コード長 178 bytes
コンパイル時間 69 ms
コンパイル使用メモリ 11,288 KB
実行使用メモリ 15,296 KB
最終ジャッジ日時 2023-09-14 04:40:10
合計ジャッジ時間 3,192 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
15,144 KB
testcase_01 AC 70 ms
15,096 KB
testcase_02 AC 67 ms
15,044 KB
testcase_03 AC 68 ms
15,100 KB
testcase_04 AC 67 ms
15,148 KB
testcase_05 AC 68 ms
15,152 KB
testcase_06 AC 69 ms
15,284 KB
testcase_07 AC 67 ms
15,296 KB
testcase_08 AC 66 ms
15,100 KB
testcase_09 AC 67 ms
15,136 KB
testcase_10 AC 67 ms
15,104 KB
testcase_11 AC 67 ms
15,148 KB
testcase_12 AC 66 ms
15,068 KB
testcase_13 AC 67 ms
15,092 KB
testcase_14 AC 67 ms
15,292 KB
testcase_15 AC 66 ms
14,988 KB
testcase_16 AC 80 ms
15,140 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

knf = gets.chomp!.split(' ').map(&:to_i)
a = gets.chomp!.split(' ').map(&:to_i).sort!

x = 0
a.each {|i| x += i}

r = knf[0] * knf[1] - x
if r >= 0
  puts r
else
  puts '-1'
end
0