結果
| 問題 | No.633 バスの運賃 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-01-20 20:46:35 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 73 ms / 2,000 ms |
| コード長 | 894 bytes |
| 記録 | |
| コンパイル時間 | 2,919 ms |
| コンパイル使用メモリ | 82,544 KB |
| 実行使用メモリ | 42,752 KB |
| 最終ジャッジ日時 | 2026-05-30 20:49:16 |
| 合計ジャッジ時間 | 4,067 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 |
ソースコード
import java.io.*;
import java.util.*;
public class Main_yukicoder633 {
private static Scanner sc;
private static Printer pr;
private static void solve() {
int n = sc.nextInt();
int[] a = new int[n - 1];
for (int i = 0; i < n - 1; i++) {
a[i] = sc.nextInt();
}
int[] b = new int[n];
int[] c = new int[n];
for (int i = 0; i < n; i++) {
b[i] = sc.nextInt();
c[i] = sc.nextInt();
}
int ans = 0;
int num = 0;
for (int i = 0; i < n; i++) {
if (i > 0) {
ans += num * a[i - 1];
}
num += c[i];
num -= b[i];
}
pr.println(ans);
}
// ---------------------------------------------------
public static void main(String[] args) {
sc = new Scanner(System.in);
pr = new Printer(System.out);
solve();
pr.close();
sc.close();
}
private static class Printer extends PrintWriter {
Printer(PrintStream out) {
super(out);
}
}
}