結果
| 問題 | No.29 パワーアップ | 
| コンテスト | |
| ユーザー |  Naoki00712 | 
| 提出日時 | 2023-05-31 17:05:59 | 
| 言語 | C (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1 ms / 5,000 ms | 
| コード長 | 410 bytes | 
| コンパイル時間 | 124 ms | 
| コンパイル使用メモリ | 26,828 KB | 
| 実行使用メモリ | 7,716 KB | 
| 最終ジャッジ日時 | 2025-10-24 21:19:31 | 
| 合計ジャッジ時間 | 971 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 22 | 
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%d", &n);
      |         ^~~~~~~~~~~~~~~
main.c:13:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |                 scanf("%d", &items);
      |                 ^~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include <stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	int bag[10] = {0};
	for (int i = 0; i < n * 3; i++)
	{
		int items;
		scanf("%d", &items);
		bag[items - 1]++;
	}
	int limited = 0, pow = 0;
	for (int i = 0; i < 10; i++)
	{
		while (bag[i] >= 2)
		{
			bag[i] += -2;
			pow++;
		}
		limited += bag[i];
	}
	while (limited >= 4)
	{
		limited += -4;
		pow++;
	}
	printf("%d", pow);
	return 0;
}
            
            
            
        