結果

問題 No.182 新規性の虜
ユーザー Himatsubushin
提出日時 2022-03-04 11:20:40
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 3,507 ms / 5,000 ms
コード長 497 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 29,824 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-18 08:34:30
合計ジャッジ時間 20,245 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>

int main(void) {
  int i, j, n, f, c, a[100001];
  
  scanf("%d", &n);
  for (i = 0; i < n; i++)
    scanf("%d", &a[i]);

  c = 0;
  for (i = 0; i < n - 1; i++) {
    f = 0;
    if (a[i] != 0) {
      for (j = i + 1; j < n; j++) {
        if (a[i] == a[j]) {
          a[j] = 0;
          f = 1;
        }
      }
      if (f > 0)
        a[i] = 0;
      else
        c++;
    }
  }
  if (a[n-1] != 0) c++;
  
  printf("%d\n", c);

  return EXIT_SUCCESS;
}
0