結果

問題 No.182 新規性の虜
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2015-06-24 15:34:15
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 623 bytes
コンパイル時間 2,290 ms
コンパイル使用メモリ 72,700 KB
実行使用メモリ 65,400 KB
最終ジャッジ日時 2023-09-22 00:30:10
合計ジャッジ時間 13,167 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
56,088 KB
testcase_01 AC 124 ms
56,032 KB
testcase_02 AC 125 ms
56,016 KB
testcase_03 AC 128 ms
55,552 KB
testcase_04 AC 127 ms
56,084 KB
testcase_05 AC 131 ms
55,560 KB
testcase_06 AC 128 ms
56,136 KB
testcase_07 AC 130 ms
55,964 KB
testcase_08 AC 509 ms
63,136 KB
testcase_09 AC 645 ms
62,772 KB
testcase_10 AC 595 ms
62,856 KB
testcase_11 AC 582 ms
63,312 KB
testcase_12 AC 416 ms
61,176 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 125 ms
55,804 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 126 ms
55,908 KB
testcase_24 AC 589 ms
65,400 KB
testcase_25 AC 478 ms
61,516 KB
testcase_26 AC 288 ms
60,340 KB
testcase_27 AC 126 ms
55,804 KB
evil01.txt AC 695 ms
66,476 KB
evil02.txt AC 660 ms
67,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;

public class Main {
	public static int solve(int[] A){
		int count = 0;
		HashSet<Integer> cheack = new HashSet<Integer>();
		
		for(int now : A){
			if (cheack.contains(now)) {
				count--;
				continue;
			}
			else {
				cheack.add(now);
				count++;
			}
		}
		
		if(count > 0) return count; else return 0;
	}
	
	public static void main(String[] args){
		Scanner S = new Scanner(System.in);
		int N = S.nextInt();
		int A[] = new int[N];

		for (int i = 0; i < N; i++) {
			A[i] = S.nextInt();
		}
		
		System.out.println(solve(A));
	}
}
0