結果
| 問題 |
No.633 バスの運賃
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-01-20 20:46:35 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 148 ms / 2,000 ms |
| コード長 | 894 bytes |
| コンパイル時間 | 3,990 ms |
| コンパイル使用メモリ | 77,664 KB |
| 実行使用メモリ | 41,556 KB |
| 最終ジャッジ日時 | 2024-12-25 03:44:02 |
| 合計ジャッジ時間 | 5,420 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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);
}
}
}