結果

問題 No.633 バスの運賃
ユーザー d2verbd2verb
提出日時 2018-01-20 17:16:38
言語 Crystal
(1.11.2)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 227 bytes
コンパイル時間 18,389 ms
コンパイル使用メモリ 254,648 KB
実行使用メモリ 4,588 KB
最終ジャッジ日時 2023-09-13 09:38:25
合計ジャッジ時間 19,281 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 2 ms
4,420 KB
testcase_04 AC 3 ms
4,380 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 3 ms
4,456 KB
testcase_07 AC 3 ms
4,588 KB
testcase_08 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = gets.not_nil!.to_i
a = [] of Int32
(n-1).times do
  a << gets.not_nil!.to_i
end

cnt = 0
ans = 0

n.times do |i|
  b, c = gets.not_nil!.split.map &.to_i
  break if i == n - 1
  cnt += (c - b)
  ans += cnt * a[i]
end

p ans
0