結果

問題 No.586 ダブルブッキング
ユーザー jimano
提出日時 2018-01-25 10:43:56
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 877 bytes
コンパイル時間 4,597 ms
コンパイル使用メモリ 74,936 KB
実行使用メモリ 50,392 KB
最終ジャッジ日時 2024-12-26 15:27:45
合計ジャッジ時間 5,165 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 2 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

package me.yukicoder.lv1;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class No0586 {
	public static void main(String[] args) {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			int yukiPrice = Integer.parseInt(br.readLine());
			int furikaePrice = Integer.parseInt(br.readLine());
			int cntReserve = Integer.parseInt(br.readLine());
			int cntDupulicate = 0;
			int[] reserve = new int[cntReserve];

			for (int i = 0; i < reserve.length; i++) {
				reserve[i] = Integer.parseInt(br.readLine());
			}

			for (int i = 0; i < reserve.length - 1; i++) {
				cntDupulicate = (reserve[i] == reserve[i + 1]) ? cntDupulicate + 1
						: cntDupulicate;
			}
			System.out.println((yukiPrice + furikaePrice) * cntDupulicate);

		}
		catch (IOException e) {
			e.printStackTrace();
		}
	}
}
0