結果

問題 No.182 新規性の虜
ユーザー しめはじめ
提出日時 2019-08-09 12:29:01
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 693 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 29,312 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-19 06:44:03
合計ジャッジ時間 1,546 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 3 WA * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int compare_long(const void* a, const void* b)
{
	return( *(long*)a - *(long*)b );
}

int main(void){
    int n;
    scanf( "%d", &n );
    int i, j, temp;
    long num[n + 2];
    int ans = 0;

    if( n == 1 ){
        ans = 1;
    }else{
    	num[0] = -1;
    	for( i = 0; i < n; i++ ){
    	    scanf( "%ld", &num[(i+1)] );
    	}
    	num[n+1] = 100000000001;
    	qsort(num, n + 2, sizeof(long), compare_long);
	
        for( i = 1; i <= n; i++ ){
    		if( num[i] != num[i+1] && num[i] != num[i-1] ){
    		    printf( "%ld [%ld] [%ld] [%ld] / ", i, num[i-1], num[i], num[i+1] );
    			ans++;
    		}
        }
    }
    printf( "%d\n", ans );
}
0