結果

問題 No.2851 Make Pairs
ユーザー Maeda
提出日時 2025-03-17 16:46:28
言語 C
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 354 bytes
コンパイル時間 327 ms
コンパイル使用メモリ 25,344 KB
実行使用メモリ 14,772 KB
最終ジャッジ日時 2025-03-17 16:46:33
合計ジャッジ時間 4,551 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 TLE * 1 -- * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         scanf("%d",&n);
      |         ^~~~~~~~~~~~~~
main.c:9:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |                 scanf("%d",&cardList[i]);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

void main(void) {
	int n;
	scanf("%d",&n);
	int cardList[n];
	int count = 0;
	for(int i = 0 ; i < n ; i++){
		scanf("%d",&cardList[i]);
		for(int j = 0 ; j < i ; j++ ){
			if(cardList[i] == cardList[j]){
				cardList[i] = 0;
				cardList[j] = 0;
			}
			if(cardList[i] == 0){
				count++;
				break;
			}
		}
	}
	printf("%d",count);
}
0