結果

問題 No.182 新規性の虜
ユーザー taketake
提出日時 2016-07-10 17:12:41
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,141 bytes
コンパイル時間 5,542 ms
コンパイル使用メモリ 76,568 KB
実行使用メモリ 58,208 KB
最終ジャッジ日時 2024-04-21 12:02:37
合計ジャッジ時間 30,272 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
40,256 KB
testcase_01 AC 134 ms
41,384 KB
testcase_02 AC 132 ms
41,136 KB
testcase_03 AC 134 ms
41,432 KB
testcase_04 AC 120 ms
40,072 KB
testcase_05 AC 140 ms
41,264 KB
testcase_06 AC 137 ms
41,092 KB
testcase_07 AC 139 ms
41,104 KB
testcase_08 AC 1,327 ms
48,128 KB
testcase_09 AC 2,525 ms
58,208 KB
testcase_10 AC 2,142 ms
57,972 KB
testcase_11 AC 1,679 ms
57,960 KB
testcase_12 AC 672 ms
48,108 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 136 ms
40,900 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 130 ms
41,152 KB
testcase_24 AC 2,649 ms
58,144 KB
testcase_25 AC 601 ms
49,476 KB
testcase_26 AC 446 ms
47,476 KB
testcase_27 AC 131 ms
41,092 KB
evil01.txt AC 2,728 ms
58,076 KB
evil02.txt AC 2,931 ms
58,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	
	static boolean hb[];
	
	public static void main (String[] args) throws java.lang.Exception
	{
	    Scanner sc = new Scanner(System.in);

	    // N(配列数)
	    int n = sc.nextInt();
	    //System.out.println("n=" + n);
	    
	    hb= new boolean[n]; 
	    

	    // 配列
	    int hs[];
	    hs= new int[n]; 

        int index = 0;
	    while((sc.hasNext()) && (index < n + 1)){
	        int s = sc.nextInt();
	        hs[index] = s;
	        //System.out.println("hs[index]=" + hs[index]);
		    index++;
	    }

		// 新規カウント
		int c = 0;
	    for (int i = 0; i < n; i++){
		  	if (isSinki(hs, n, i) ) {
		  		c++;
		  	}
		}
		
		System.out.println(c);
	}
	
	
	public static boolean isSinki (int[] hs, int n, int index) {
		
		if (hb[index]) {
			return false;
		}
		
		
		for (int i = index + 1; i < n; i++){
			
				if (hs[i] == hs[index]) {
					hb[i] = true;
					return false;
				}

		}
		
		return true;		
	}
	
		
}
0