結果
| 問題 | No.633 バスの運賃 | 
| コンテスト | |
| ユーザー |  ebicochineal | 
| 提出日時 | 2018-01-19 21:58:45 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3 ms / 2,000 ms | 
| コード長 | 495 bytes | 
| コンパイル時間 | 1,824 ms | 
| コンパイル使用メモリ | 167,920 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-24 12:32:45 | 
| 合計ジャッジ時間 | 2,337 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 9 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;
    cin >> N;
    int t;
    vector<int> a;
    int ans = 0;
    
    for (int i = 0; i < N-1; ++i) {
        cin >> t;
        a.push_back(t);
    }
    
    int v;
    cin >> t >> v;
    for (int i = 1; i < N; ++i) {
        ans += a[i-1] * v;
        cin >> t;
        v -= t;
        cin >> t;
        v += t;
    }
    
    cout << ans << endl;
    
    return 0;
}
            
            
            
        