結果

問題 No.182 新規性の虜
ユーザー nCk_cvnCk_cv
提出日時 2015-04-20 12:25:17
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 572 bytes
コンパイル時間 2,590 ms
コンパイル使用メモリ 72,544 KB
実行使用メモリ 64,708 KB
最終ジャッジ日時 2023-09-18 00:41:31
合計ジャッジ時間 16,263 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,956 KB
testcase_01 AC 125 ms
55,896 KB
testcase_02 AC 127 ms
55,656 KB
testcase_03 AC 125 ms
55,884 KB
testcase_04 AC 124 ms
55,800 KB
testcase_05 AC 130 ms
56,208 KB
testcase_06 AC 124 ms
55,648 KB
testcase_07 AC 128 ms
56,308 KB
testcase_08 AC 481 ms
60,532 KB
testcase_09 AC 614 ms
60,420 KB
testcase_10 AC 550 ms
60,400 KB
testcase_11 AC 538 ms
60,700 KB
testcase_12 AC 395 ms
60,244 KB
testcase_13 AC 125 ms
56,040 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 127 ms
56,060 KB
testcase_17 AC 129 ms
57,944 KB
testcase_18 AC 512 ms
60,824 KB
testcase_19 AC 423 ms
60,384 KB
testcase_20 AC 359 ms
60,356 KB
testcase_21 AC 530 ms
60,440 KB
testcase_22 AC 394 ms
60,340 KB
testcase_23 WA -
testcase_24 AC 499 ms
60,320 KB
testcase_25 AC 2,960 ms
64,708 KB
testcase_26 AC 280 ms
60,348 KB
testcase_27 AC 121 ms
55,736 KB
evil01.txt AC 561 ms
61,212 KB
evil02.txt AC 575 ms
60,884 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;
						break;
					}
				}
			}
		}
		
		System.out.println(count);
		
		
		
				
	}
}	


			
0