結果

問題 No.586 ダブルブッキング
ユーザー sudo_yum
提出日時 2018-05-25 14:37:35
言語 Java
(openjdk 23)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 630 bytes
コンパイル時間 1,801 ms
コンパイル使用メモリ 74,936 KB
実行使用メモリ 41,680 KB
最終ジャッジ日時 2024-06-28 17:59:18
合計ジャッジ時間 3,403 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main{
  static StringBuilder sb = new StringBuilder("");
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int P1 = sc.nextInt();
    int P2 = sc.nextInt();
    int nin = sc.nextInt();
    int[] heya = new int[nin];
    for (int i=0;i<nin ;i++ ) {
      heya[i] = sc.nextInt();
    }
    sc.close();
    Arrays.sort(heya);

    int temp = heya[0];
    int cnt = 0;
    for (int i=1;i<nin ;i++ ) {
      if (temp==heya[i]) {
          cnt++;
      }else{
        temp=heya[i];
      }
    }
    int result = (P1+P2)*cnt;
    System.out.println(result);
  }
}
0