結果
問題 |
No.182 新規性の虜
|
ユーザー |
![]() |
提出日時 | 2015-06-24 23:42:32 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 968 ms / 5,000 ms |
コード長 | 693 bytes |
コンパイル時間 | 4,537 ms |
コンパイル使用メモリ | 75,704 KB |
実行使用メモリ | 50,780 KB |
最終ジャッジ日時 | 2024-12-26 19:27:01 |
合計ジャッジ時間 | 17,865 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
ソースコード
import java.util.ArrayList; import java.util.HashSet; import java.util.Scanner; public class Main { static int N; static ArrayList<Integer> A; static private void solve() { int ans = 0; int prenum = -1; int count = 0; for (Integer i : A) { if(i == prenum) { count++; } else { prenum = i; if(count == 1) ans++; count = 1; } } if (count == 1) ans++; System.out.println(ans); } static public void main(String[] args) { Scanner sca = new Scanner(System.in); N = sca.nextInt(); A = new ArrayList<Integer>(); for (int i = 0; i < N; i++) { A.add(new Integer(sca.nextInt())); } A.sort(null); solve(); } }