結果
| 問題 | No.633 バスの運賃 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-11-16 19:40:33 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 136 ms / 2,000 ms | 
| コード長 | 426 bytes | 
| コンパイル時間 | 2,299 ms | 
| コンパイル使用メモリ | 74,104 KB | 
| 実行使用メモリ | 41,896 KB | 
| 最終ジャッジ日時 | 2024-12-24 14:14:00 | 
| 合計ジャッジ時間 | 4,027 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 9 | 
ソースコード
import java.util.Scanner;
class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), a[] = new int[n - 1], b, c, sum = 0, ans = 0;
		for (int i = 0; i < n - 1; ++i) a[i] = sc.nextInt();
		for (int i = 0; i < n - 1; ++i) {
			b = sc.nextInt();
			c = sc.nextInt();
			sum += c - b;
			ans += sum * a[i];
		}
		sc.close();
		System.out.print(ans);
	}
}
            
            
            
        