結果

問題 No.29 パワーアップ
コンテスト
ユーザー ひゅーら
提出日時 2017-06-19 17:00:44
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 406 bytes
コンパイル時間 526 ms
コンパイル使用メモリ 27,344 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-10-24 21:02:00
合計ジャッジ時間 1,232 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13 WA * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:4:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    4 |         scanf("%d", &n);
      |         ^~~~~~~~~~~~~~~
main.c:11:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |                 scanf("%d", &a);
      |                 ^~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
int main(void){
	int n;
	scanf("%d", &n);
	int items[10];
	for(int i = 0; i < 10; i++){
		items[i] = 0;
	}
	for(int i = 0; i < n*3; i++){
		int a;
		scanf("%d", &a);
		items[a-1]++;
	}
	int ans = 0;
	for(int i = 0; i < 10; i++){
		ans += items[i] / 2;
		items[i] %= 2;
	}
	int sum = 0;
	for(int i = 0; i < 10; i++){
		sum += items[i];
	}
	ans += sum/5;
	printf("%d\n", ans);
	return 0;
}
0