結果
| 問題 |
No.633 バスの運賃
|
| コンテスト | |
| ユーザー |
takeya_okino
|
| 提出日時 | 2019-08-17 00:03:47 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 155 ms / 2,000 ms |
| コード長 | 659 bytes |
| コンパイル時間 | 2,694 ms |
| コンパイル使用メモリ | 80,244 KB |
| 実行使用メモリ | 55,944 KB |
| 最終ジャッジ日時 | 2024-09-23 04:31:36 |
| 合計ジャッジ時間 | 4,359 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / 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();
int[] a = new int[n - 1];
int[] b = new int[n];
int[] c = new int[n];
for(int i = 0; i < n - 1; i++) {
a[i] = sc.nextInt();
}
for(int i = 0; i < n; i++) {
if(i == 0) {
b[i] = sc.nextInt();
c[i] = sc.nextInt();
} else {
b[i] = (b[i - 1] + sc.nextInt());
c[i] = (c[i - 1] + sc.nextInt());
}
}
int ans = 0;
for(int i = 0; i < n - 1; i++) {
ans += ((a[i]) * (c[i] - b[i]));
}
System.out.println(ans);
}
}
takeya_okino