結果

問題 No.182 新規性の虜
ユーザー koukonkokoukonko
提出日時 2015-12-14 13:23:12
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 809 bytes
コンパイル時間 2,078 ms
コンパイル使用メモリ 73,424 KB
実行使用メモリ 64,360 KB
最終ジャッジ日時 2023-10-13 16:31:08
合計ジャッジ時間 8,356 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
49,500 KB
testcase_01 AC 44 ms
49,548 KB
testcase_02 AC 44 ms
49,512 KB
testcase_03 AC 45 ms
49,748 KB
testcase_04 AC 45 ms
49,520 KB
testcase_05 AC 46 ms
49,600 KB
testcase_06 AC 45 ms
49,876 KB
testcase_07 AC 46 ms
49,368 KB
testcase_08 AC 263 ms
59,008 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 44 ms
49,856 KB
testcase_14 AC 45 ms
49,668 KB
testcase_15 AC 44 ms
49,572 KB
testcase_16 AC 44 ms
49,516 KB
testcase_17 AC 45 ms
49,684 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 44 ms
49,560 KB
testcase_24 AC 234 ms
62,424 KB
testcase_25 AC 177 ms
58,980 KB
testcase_26 AC 123 ms
52,996 KB
testcase_27 AC 44 ms
49,588 KB
evil01.txt AC 238 ms
63,168 KB
evil02.txt AC 241 ms
62,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {
	public static void main(String[] args) {
		BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
		try {

			int N = Integer.parseInt(read.readLine());
			String[] line = read.readLine().split(" ");
			List<Integer> list = new ArrayList<>(N);
			list.add(0);
			for (int i = 0; i < N; ++i) {
				list.add(Integer.parseInt(line[i]));
			}
			list.add(Integer.MAX_VALUE);
			list.sort(null);

			int ans = 0;
			for (int i = 1; i <= N; ++i) {
				if (list.get(i - 1) != list.get(i) && list.get(i + 1) != list.get(i)) {
					++ans;
				}
			}

			System.out.println(ans);

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