結果
| 問題 | No.633 バスの運賃 | 
| コンテスト | |
| ユーザー |  kichirb3 | 
| 提出日時 | 2018-03-07 12:52:39 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 581 bytes | 
| コンパイル時間 | 515 ms | 
| コンパイル使用メモリ | 69,552 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-10-01 20:36:16 | 
| 合計ジャッジ時間 | 1,010 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 9 | 
ソースコード
// No.633 バスの運賃
// https://yukicoder.me/problems/no/633
//
#include <iostream>
#include <vector>
using namespace std;
int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    unsigned int n;
    cin >> n;
    vector<int> fees(n, 0);
    for (auto i = 1; i < n; ++i)
        cin >> fees[i];
    int passenger = 0;
    int total_fee = 0;
    for (auto i = 0; i < n; ++i) {
        total_fee += passenger * fees[i];
        int b, c;
        cin >> b >> c;
        passenger -= b;
        passenger += c;
    }
    cout << total_fee << endl;
}
            
            
            
        