結果
| 問題 |
No.182 新規性の虜
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-04-16 00:25:45 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 551 bytes |
| コンパイル時間 | 176 ms |
| コンパイル使用メモリ | 30,336 KB |
| 実行使用メモリ | 14,008 KB |
| 最終ジャッジ日時 | 2024-06-27 02:25:43 |
| 合計ジャッジ時間 | 34,124 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 WA * 8 TLE * 3 -- * 5 |
ソースコード
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
int n, *a;
char str[10000], *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;
}