結果
| 問題 |
No.2851 Make Pairs
|
| コンテスト | |
| ユーザー |
Maeda
|
| 提出日時 | 2025-03-19 11:21:18 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 342 bytes |
| コンパイル時間 | 413 ms |
| コンパイル使用メモリ | 25,216 KB |
| 実行使用メモリ | 14,904 KB |
| 最終ジャッジ日時 | 2025-03-19 11:21:22 |
| 合計ジャッジ時間 | 4,223 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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",&card[i]);
| ^~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
void main(void){
int n = 0;
scanf("%d",&n);
int card[n];
int count = 0;
for(int i = 0; i < n ; i++){
scanf("%d",&card[i]);
for(int j = 0 ;j < i;j++){
if(card[i] == -1){
continue;
}
if(card[i] == card[j]){
card[i] = -1;
card[j] = -1;
count++;
break;
}
}
}
printf("%d",count);
}
Maeda