結果

問題 No.182 新規性の虜
ユーザー TLwiegehtt
提出日時 2015-07-08 01:33:37
言語 C90
(gcc 12.3.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 356 bytes
コンパイル時間 686 ms
コンパイル使用メモリ 20,992 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-12-26 19:28:36
合計ジャッジ時間 38,566 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23 TLE * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%d", &n);
      |         ^~~~~~~~~~~~~~~
main.c:9:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |                 scanf("%d", &a[i]);
      |                 ^~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void){
	int cnt = 0;
	int i,j,n;
	int a[100010];
	scanf("%d", &n);
	for(i=0;i<n;i++){
		scanf("%d", &a[i]);
	}
	for(i=0;i<n;i++){
		int num = a[i];
		if(a[i] == 0){continue;}
		
		for(j=i+1;j<n;j++){
			if(num == a[j]){
				a[i] = 0;
				a[j] = 0;
			}
		}
		if(a[i] != 0){
			cnt++;
		}
	}
	
	printf("%d\n", cnt);
	return 0;
}
0