結果

問題 No.1096 Range Sums
ユーザー simansiman
提出日時 2020-09-03 05:47:44
言語 Ruby
(3.3.0)
結果
AC  
実行時間 174 ms / 2,000 ms
コード長 130 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 11,304 KB
実行使用メモリ 27,152 KB
最終ジャッジ日時 2023-08-14 16:11:00
合計ジャッジ時間 3,175 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,052 KB
testcase_01 AC 80 ms
15,272 KB
testcase_02 AC 81 ms
15,088 KB
testcase_03 AC 81 ms
15,268 KB
testcase_04 AC 80 ms
15,228 KB
testcase_05 AC 80 ms
15,232 KB
testcase_06 AC 80 ms
15,020 KB
testcase_07 AC 80 ms
15,280 KB
testcase_08 AC 81 ms
15,076 KB
testcase_09 AC 82 ms
15,264 KB
testcase_10 AC 174 ms
27,000 KB
testcase_11 AC 172 ms
26,952 KB
testcase_12 AC 173 ms
27,060 KB
testcase_13 AC 174 ms
27,088 KB
testcase_14 AC 173 ms
27,152 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
A = gets.split.map(&:to_i)

ans = 0

A.each_with_index do |a, idx|
  ans += (idx + 1) * (N - idx) * a
end

puts ans
0