結果

問題 No.633 バスの運賃
ユーザー kyo1
提出日時 2021-01-10 23:50:14
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 379 bytes
コンパイル時間 1,995 ms
コンパイル使用メモリ 192,984 KB
最終ジャッジ日時 2025-01-17 16:02:30
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<int> A(N - 1);
  for (auto &&e : A) {
    cin >> e;
  }
  int res = 0, cur = 0;
  for (int i = 0; i < N; i++) {
    int b, c;
    cin >> b >> c;
    cur += c;
    cur -= b;
    res += cur * A[i];
  }
  cout << res << '\n';
  return 0;
}
0