結果
| 問題 |
No.2851 Make Pairs
|
| コンテスト | |
| ユーザー |
Maeda
|
| 提出日時 | 2025-03-27 10:21:57 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 418 bytes |
| コンパイル時間 | 475 ms |
| コンパイル使用メモリ | 25,344 KB |
| 実行使用メモリ | 7,328 KB |
| 最終ジャッジ日時 | 2025-03-27 10:21:59 |
| 合計ジャッジ時間 | 1,498 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 WA * 3 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | scanf("%d",&n);
| ^~~~~~~~~~~~~~
main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%d",&selectNumber);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
void main(void){
int n = 0 ;
scanf("%d",&n);
int numList[n] = {};
for(int i = 0 ; i < n ; i++){
int selectNumber = 0;
scanf("%d",&selectNumber);
numList[selectNumber-1]++;
}
int count = 0;
for(int i = 0 ; i < n ; i++){
if( numList[i] > 1 && numList[i]%2 == 0){
count += numList[i]/2;
}
}
printf("%d",count);
}
Maeda