結果
問題 | No.586 ダブルブッキング |
ユーザー |
![]() |
提出日時 | 2017-11-03 22:22:40 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 142 ms / 2,000 ms |
コード長 | 619 bytes |
コンパイル時間 | 2,087 ms |
コンパイル使用メモリ | 74,784 KB |
実行使用メモリ | 41,464 KB |
最終ジャッジ日時 | 2024-11-22 15:50:49 |
合計ジャッジ時間 | 3,723 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 |
ソースコード
import java.util.Arrays;import java.util.HashSet;import java.util.LinkedList;import java.util.Scanner;public class Main {public static long MOD = 1000000007;public static void main(String[] args) {Scanner sc = new Scanner(System.in);final long P1 = sc.nextLong();final long P2 = sc.nextLong();long answer = 0;final int N = sc.nextInt();HashSet<Integer> already = new HashSet<Integer>();for(int i = 0; i < N; i++){final int R = sc.nextInt();if(already.contains(R)){answer += P1 + P2;}else{already.add(R);}}System.out.println(answer);}}