結果

問題 No.633 バスの運賃
ユーザー Mister
提出日時 2020-04-16 09:27:16
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 446 bytes
コンパイル時間 724 ms
コンパイル使用メモリ 71,504 KB
最終ジャッジ日時 2025-01-09 19:24:35
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

void solve() {
    int n;
    std::cin >> n;

    std::vector<int> xs(n - 1);
    for (auto& x : xs) std::cin >> x;

    int ans = 0, k = 0;
    for (auto x : xs) {
        int b, c;
        std::cin >> b >> c;
        k += c - b;
        ans += k * x;
    }

    std::cout << ans << std::endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}
0