結果

問題 No.182 新規性の虜
ユーザー kenkooookenkoooo
提出日時 2015-04-16 23:35:00
言語 Java21
(openjdk 21)
結果
AC  
実行時間 192 ms / 5,000 ms
コード長 868 bytes
コンパイル時間 2,303 ms
コンパイル使用メモリ 74,028 KB
実行使用メモリ 54,492 KB
最終ジャッジ日時 2023-08-27 07:06:37
合計ジャッジ時間 6,360 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,152 KB
testcase_01 AC 44 ms
49,192 KB
testcase_02 AC 43 ms
49,028 KB
testcase_03 AC 43 ms
49,056 KB
testcase_04 AC 43 ms
49,112 KB
testcase_05 AC 43 ms
48,916 KB
testcase_06 AC 44 ms
49,280 KB
testcase_07 AC 43 ms
48,904 KB
testcase_08 AC 153 ms
53,532 KB
testcase_09 AC 192 ms
54,160 KB
testcase_10 AC 180 ms
54,492 KB
testcase_11 AC 163 ms
52,308 KB
testcase_12 AC 111 ms
53,312 KB
testcase_13 AC 44 ms
49,624 KB
testcase_14 AC 44 ms
49,068 KB
testcase_15 AC 44 ms
49,152 KB
testcase_16 AC 44 ms
49,152 KB
testcase_17 AC 44 ms
49,084 KB
testcase_18 AC 157 ms
53,536 KB
testcase_19 AC 123 ms
54,020 KB
testcase_20 AC 108 ms
53,028 KB
testcase_21 AC 169 ms
54,112 KB
testcase_22 AC 115 ms
53,224 KB
testcase_23 AC 43 ms
49,296 KB
testcase_24 AC 100 ms
51,816 KB
testcase_25 AC 89 ms
51,928 KB
testcase_26 AC 86 ms
53,076 KB
testcase_27 AC 47 ms
49,228 KB
evil01.txt AC 111 ms
51,556 KB
evil02.txt AC 108 ms
51,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.IOException;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws Exception {
		int N = nextInt();
		int[] input = new int[N];
		for (int i = 0; i < N; i++) {
			input[i] = nextInt();
		}
		Arrays.sort(input);
		int ans = 0;
		for (int i = 0; i < N; i++) {
			if ((i == 0 || input[i - 1] != input[i]) && (i == N - 1 || input[i] != input[i + 1])) {
				ans++;
			}
		}
		System.out.println(ans);
	}

	static int nextInt() {
		int c;
		try {
			c = System.in.read();
			while (c != '-' && (c < '0' || c > '9'))
				c = System.in.read();
			if (c == '-')
				return -nextInt();
			int res = 0;
			while (c >= '0' && c <= '9') {
				res = res * 10 + c - '0';
				c = System.in.read();
			}
			return res;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return -1;
	}
}
0