結果
| 問題 |
No.182 新規性の虜
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-03-01 12:31:10 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 172 ms / 5,000 ms |
| コード長 | 2,367 bytes |
| コンパイル時間 | 2,306 ms |
| コンパイル使用メモリ | 82,032 KB |
| 実行使用メモリ | 59,472 KB |
| 最終ジャッジ日時 | 2024-06-23 12:01:34 |
| 合計ジャッジ時間 | 6,343 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
import java.util.*;
import java.util.stream.*;
import static java.lang.System.*;
import java.io.*;
class Main {
static int maxInt = Integer.MAX_VALUE;
static int minInt = Integer.MIN_VALUE;
static int max (int... ar) {Arrays.sort(ar);return ar[ar.length-1];}
static int min (int... ar) {Arrays.sort(ar);return ar[0];}
static FastScanner sc = new FastScanner();
public static void main(String[] args) {
//MAIN----------------------------------------------------------
int n = sc.nextInt();
HashMap<Integer, Integer> map = new HashMap<>();
for (int i=0; i<n; i++) {
int temp = sc.nextInt();
map.put(temp, map.getOrDefault(temp,0)+1);
}
int ans = 0;
for (Map.Entry<Integer, Integer> e: map.entrySet()) {
if (e.getValue() == 1) ans++;
}
out.println(ans);
//--------------------------------------------------------------
}
}
class FastScanner {
private InputStream in = System.in;
private byte[] buffer = new byte[1024];
private int length = 0;
private int p = 0;
boolean hasNextByte () {
if (p < length) return true;
else {
p = 0;
try {length = in.read(buffer);}
catch (Exception e) {e.printStackTrace();}
if (length == 0) return false;
}
return true;
}
int readByte () {
if (hasNextByte() == true) return buffer[p++];
return -1;
}
boolean isPrintable (int n) {return 33<=n&&n<=126;}
void skip () {
while (hasNextByte() && !isPrintable(buffer[p])) p++;
}
boolean hasNext () {skip(); return hasNextByte();}
String next () {
if (!hasNext()) throw new NoSuchElementException();
StringBuilder sb = new StringBuilder();
int temp = readByte();
while (isPrintable(temp)) {
sb.appendCodePoint(temp);
temp = readByte();
}
return sb.toString();
}
public int nextInt () {
return (int) nextLong();
}
public int[] nextInts (int n) {
int[] ar = new int[n];
for (int i=0; i<n; i++) ar[i] = nextInt();
return ar;
}
public long nextLong () {
if (!hasNext()) throw new NoSuchElementException();
boolean minus = false;
int temp = readByte();
if (temp == '-') {
minus = true;
temp = readByte();
}
if (temp<'0' || '9'<temp) throw new NumberFormatException();
long n = 0;
while (isPrintable(temp)) {
if ('0'<=temp && temp<='9') {
n *= 10;
n += temp - '0';
}
temp = readByte();
}
return minus? -n : n;
}
}