結果

問題 No.633 バスの運賃
ユーザー むらためむらため
提出日時 2019-01-18 10:03:04
言語 Nim
(2.0.2)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 459 bytes
コンパイル時間 1,847 ms
コンパイル使用メモリ 66,420 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-14 02:10:11
合計ジャッジ時間 2,407 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import sequtils

proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc scan(): int =
  while true:
    var k = getchar_unlocked()
    if k < '0' or k > '9': break
    else: result = 10 * result + k.ord - '0'.ord

let n = scan()
let A = newSeqWith(n-1,scan())
var ans = 0
var x = 0
block:
  let b = scan()
  let c = scan()
  x += c - b
for i in 1..<n:
  let b = scan()
  let c = scan()
  ans += x * A[i-1]
  x += c - b
echo ans
0