結果
| 問題 |
No.476 正しくない平均
|
| ユーザー |
|
| 提出日時 | 2017-03-17 23:24:24 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 88 ms / 2,000 ms |
| コード長 | 218 bytes |
| コンパイル時間 | 87 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 12,288 KB |
| 最終ジャッジ日時 | 2024-07-04 13:45:00 |
| 合計ジャッジ時間 | 3,199 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
コンパイルメッセージ
Syntax OK
ソースコード
def calc_avg(nums)
nums.inject(&:+).to_f/nums.count
end
def parse(str_nums)
str_nums.split(' ').map(&:to_i)
end
answer = parse(gets).last.to_i
problem = parse(gets)
puts answer == calc_avg(problem) ? 'YES' : 'NO'