結果
| 問題 |
No.633 バスの運賃
|
| コンテスト | |
| ユーザー |
tenten
|
| 提出日時 | 2020-09-04 19:19:56 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 146 ms / 2,000 ms |
| コード長 | 488 bytes |
| コンパイル時間 | 2,116 ms |
| コンパイル使用メモリ | 77,536 KB |
| 実行使用メモリ | 44,744 KB |
| 最終ジャッジ日時 | 2024-11-26 11:26:52 |
| 合計ジャッジ時間 | 4,105 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 |
ソースコード
import java.util.*;
public class Main {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long[] prices = new long[n - 1];
for (int i = 0; i < n - 1; i++) {
prices[i] = sc.nextInt();
}
long total = 0;
int current = 0;
for (int i = 0; i < n - 1; i++) {
current -= sc.nextInt() - sc.nextInt();
total += current * prices[i];
}
System.out.println(total);
}
}
tenten