結果
| 問題 | No.633 バスの運賃 | 
| コンテスト | |
| ユーザー |  iqueue02 | 
| 提出日時 | 2019-10-27 16:11:45 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 419 bytes | 
| コンパイル時間 | 1,583 ms | 
| コンパイル使用メモリ | 167,692 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-09-14 21:03:36 | 
| 合計ジャッジ時間 | 2,214 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 9 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
int main(){
  int n;
  cin >> n;
  vector<int> a(n-1);
  rep(i,n-1) cin >> a[i];
  int res = 0;
  int num = 0;
  rep(i,n) {
    int b, c;
    cin >> b >> c;
    num += c - b;
    if (i < n-1) res += a[i] * num; 
  }
  cout << res << endl;
  return 0;
}
            
            
            
        