結果
| 問題 | No.182 新規性の虜 |
| コンテスト | |
| ユーザー |
take
|
| 提出日時 | 2016-07-10 17:12:41 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,141 bytes |
| 記録 | |
| コンパイル時間 | 1,930 ms |
| コンパイル使用メモリ | 77,388 KB |
| 実行使用メモリ | 69,112 KB |
| 最終ジャッジ日時 | 2024-10-13 10:25:32 |
| 合計ジャッジ時間 | 24,650 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 WA * 9 |
ソースコード
/* 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;
}
}
take