結果

問題 No.476 正しくない平均
ユーザー owlworksowlworks
提出日時 2017-03-17 23:21:20
言語 Ruby
(3.2.2)
結果
WA  
実行時間 -
コード長 220 bytes
コンパイル時間 59 ms
コンパイル使用メモリ 11,208 KB
実行使用メモリ 15,320 KB
最終ジャッジ日時 2023-09-17 19:25:49
合計ジャッジ時間 3,587 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
15,284 KB
testcase_01 WA -
testcase_02 AC 80 ms
15,144 KB
testcase_03 AC 79 ms
15,284 KB
testcase_04 AC 80 ms
15,132 KB
testcase_05 WA -
testcase_06 AC 81 ms
15,312 KB
testcase_07 AC 80 ms
15,280 KB
testcase_08 AC 80 ms
15,276 KB
testcase_09 AC 79 ms
15,072 KB
testcase_10 AC 80 ms
15,148 KB
testcase_11 WA -
testcase_12 AC 79 ms
15,224 KB
testcase_13 AC 80 ms
15,148 KB
testcase_14 AC 80 ms
15,224 KB
testcase_15 AC 79 ms
15,216 KB
testcase_16 AC 80 ms
15,284 KB
testcase_17 AC 80 ms
15,148 KB
testcase_18 AC 80 ms
15,244 KB
testcase_19 AC 80 ms
15,064 KB
testcase_20 WA -
testcase_21 AC 80 ms
15,128 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 80 ms
15,216 KB
testcase_25 AC 81 ms
15,128 KB
testcase_26 WA -
testcase_27 AC 79 ms
15,060 KB
testcase_28 AC 80 ms
15,108 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def calc_avg(nums)
  (nums.inject(&:+)/nums.count).to_f
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'
0