結果
| 問題 | 
                            No.29 パワーアップ
                             | 
                    
| コンテスト | |
| ユーザー | 
                             AQUA16573837
                         | 
                    
| 提出日時 | 2018-03-31 20:34:14 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 1 ms / 5,000 ms | 
| コード長 | 442 bytes | 
| コンパイル時間 | 457 ms | 
| コンパイル使用メモリ | 44,948 KB | 
| 実行使用メモリ | 7,720 KB | 
| 最終ジャッジ日時 | 2025-10-24 21:06:01 | 
| 合計ジャッジ時間 | 893 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 22 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%d", &n);
      |         ~~~~~^~~~~~~~~~
main.cpp:12:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |                 scanf("%d %d %d", &a, &b, &c);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include <stdio.h>
#include <algorithm>
#include <deque>
using namespace std;
using ll = long long;
//29
int main() {
	int n, a, b, c, count[10] = { 0 };
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d %d %d", &a, &b, &c);
		count[a - 1]++, count[b - 1]++, count[c - 1]++;
	}
	int total = 0, rem = 0;
	for (int i = 0; i < 10; i++) {
		total += count[i] / 2;
		rem += count[i] & 1;
	}
	total += rem / 4;
	printf("%d\n", total);
}
            
            
            
        
            
AQUA16573837