結果
問題 |
No.182 新規性の虜
|
ユーザー |
|
提出日時 | 2017-03-15 14:37:02 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 377 bytes |
コンパイル時間 | 103 ms |
コンパイル使用メモリ | 21,376 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-03 23:53:55 |
合計ジャッジ時間 | 1,143 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 WA * 1 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:18:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 18 | scanf("%d",&n); | ^~~~~~~~~~~~~~ main.c:21:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 21 | scanf("%d",&a[i]); | ^~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <stdlib.h> int comp(const void *arg1, const void *arg2){ return *(int *)arg1 - *(int *)arg2; } int main(void) { int i,n,a[100000],count=0; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&a[i]); } qsort(a, n, sizeof(int), comp); for(i=0;i<n;i++){ if(a[i-1]!=a[i] && a[i]!=a[i+1]) count++; } printf("%d\n",count); return 0; }