結果

問題 No.182 新規性の虜
ユーザー nCk_cvnCk_cv
提出日時 2015-04-20 12:28:17
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 617 bytes
コンパイル時間 3,861 ms
コンパイル使用メモリ 71,576 KB
実行使用メモリ 71,372 KB
最終ジャッジ日時 2023-09-18 00:42:41
合計ジャッジ時間 14,964 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,572 KB
testcase_01 AC 123 ms
55,416 KB
testcase_02 AC 124 ms
55,676 KB
testcase_03 AC 126 ms
55,672 KB
testcase_04 AC 125 ms
55,612 KB
testcase_05 AC 129 ms
55,868 KB
testcase_06 AC 126 ms
55,692 KB
testcase_07 AC 128 ms
55,892 KB
testcase_08 AC 481 ms
60,632 KB
testcase_09 AC 599 ms
60,724 KB
testcase_10 AC 543 ms
60,676 KB
testcase_11 AC 535 ms
60,644 KB
testcase_12 AC 388 ms
60,376 KB
testcase_13 AC 128 ms
55,740 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 128 ms
55,636 KB
testcase_17 AC 132 ms
55,760 KB
testcase_18 AC 519 ms
60,364 KB
testcase_19 AC 428 ms
60,120 KB
testcase_20 AC 365 ms
60,064 KB
testcase_21 AC 511 ms
60,344 KB
testcase_22 AC 401 ms
60,412 KB
testcase_23 WA -
testcase_24 AC 516 ms
60,480 KB
testcase_25 AC 2,870 ms
71,372 KB
testcase_26 AC 290 ms
60,796 KB
testcase_27 AC 125 ms
55,756 KB
evil01.txt AC 568 ms
60,948 KB
evil02.txt AC 583 ms
60,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int[] list = new int[n];
		for(int i = 0; i < n; i++) {
			list[i] = sc.nextInt();
		}
		
		Arrays.sort(list);
		int count = 0;
		for(int i = 0; i < n-1; i++) {
			if(list[i] != list[i+1] ){
				count++;
				if(i == n-2) {
				count++;
				}
			}
			else {
				for(int j = i+1; j < n; j++) {
					if(list[i] != list[j]) {
						i = j-1;
						if(i == n-1) {
							count++;
						}
						break;
					}
				}
			}
		}
		
		System.out.println(count);
		
		
		
				
	}
}	


			
0