結果

問題 No.1586 Equal Array
ユーザー 小野寺健小野寺健
提出日時 2021-11-12 21:19:47
言語 Ruby
(3.3.0)
結果
AC  
実行時間 138 ms / 1,000 ms
コード長 230 bytes
コンパイル時間 401 ms
コンパイル使用メモリ 11,280 KB
実行使用メモリ 24,236 KB
最終ジャッジ日時 2023-08-16 21:12:48
合計ジャッジ時間 4,914 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
15,020 KB
testcase_01 AC 76 ms
15,196 KB
testcase_02 AC 76 ms
15,284 KB
testcase_03 AC 76 ms
15,124 KB
testcase_04 AC 120 ms
21,300 KB
testcase_05 AC 116 ms
21,156 KB
testcase_06 AC 120 ms
22,108 KB
testcase_07 AC 119 ms
21,952 KB
testcase_08 AC 119 ms
21,888 KB
testcase_09 AC 121 ms
22,144 KB
testcase_10 AC 120 ms
21,992 KB
testcase_11 AC 77 ms
15,248 KB
testcase_12 AC 77 ms
15,120 KB
testcase_13 AC 128 ms
21,948 KB
testcase_14 AC 130 ms
21,948 KB
testcase_15 AC 129 ms
22,152 KB
testcase_16 AC 127 ms
21,896 KB
testcase_17 AC 76 ms
15,024 KB
testcase_18 AC 138 ms
24,236 KB
testcase_19 AC 138 ms
24,168 KB
testcase_20 AC 75 ms
15,292 KB
testcase_21 AC 75 ms
15,228 KB
testcase_22 AC 76 ms
15,104 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i

A = gets.split(" ").map{|s| s.to_i}

sum = A.sum

if sum % N != 0
	ans = "No"
else
	ans = "Yes"
	av = sum
	rest = 0
	A.each {|x|
		if av - x < rest then
			ans = "No"
			break
		end
		rest -= av - x
	}
end

puts ans
0