結果

問題 No.182 新規性の虜
ユーザー nCk_cv
提出日時 2015-04-20 12:25:17
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 572 bytes
コンパイル時間 1,956 ms
コンパイル使用メモリ 74,248 KB
実行使用メモリ 58,044 KB
最終ジャッジ日時 2024-07-04 17:48:38
合計ジャッジ時間 15,207 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24 WA * 3
権限があれば一括ダウンロードができます

ソースコード

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