結果

問題 No.182 新規性の虜
ユーザー Mcpu3
提出日時 2018-04-16 00:23:34
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 548 bytes
コンパイル時間 788 ms
コンパイル使用メモリ 30,080 KB
実行使用メモリ 8,480 KB
最終ジャッジ日時 2024-06-27 02:24:57
合計ジャッジ時間 38,411 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 3 WA * 16 TLE * 3 -- * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(void)
{
	int n, *a;
	char str[32], *ch;
	scanf("%d%*c", &n);
	a = malloc(sizeof(int)*n);
	fgets(str, sizeof(str), stdin);
	ch = strtok(str, " \n");
	for (int i = 0; i < n; i++) {
		if (ch == NULL) break;
		else a[i] = atoi(ch);
		ch = strtok(NULL, " \n");
	}
	int x, sum = 0;
	for (int i = 0; i < n; i++) {
		x = 0;
		for (int j = 0; j < n; j++) if (a[i] == a[j]) x++;
		if (x > 1) sum++;
	}
	sum = n - sum;
	printf("%d\n", sum);
	free(a);
	return 0;
}
0