結果

問題 No.633 バスの運賃
ユーザー square1001
提出日時 2018-01-21 16:09:57
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 376 bytes
コンパイル時間 641 ms
コンパイル使用メモリ 65,384 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-25 21:11:26
合計ジャッジ時間 1,300 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <string>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
int n, a[100009], b[100009], c[100009];
int main() {
	cin >> n;
	for (int i = 0; i < n - 1; i++) cin >> a[i];
	long long sum = 0, ret = 0;
	for (int i = 0; i < n - 1; i++) {
		cin >> b[i] >> c[i];
		sum += b[i] - c[i];
		ret += a[i] * sum;
	}
	cout << -ret << endl;
	return 0;
}
0