結果

問題 No.29 パワーアップ
コンテスト
ユーザー fura
提出日時 2020-01-09 18:16:06
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 311 bytes
コンパイル時間 1,278 ms
コンパイル使用メモリ 162,644 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-10-24 21:12:43
合計ジャッジ時間 2,156 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         int n; scanf("%d",&n);
      |                ~~~~~^~~~~~~~~
main.cpp:11:29: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |                 int a; scanf("%d",&a);
      |                        ~~~~~^~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int n; scanf("%d",&n);
	int cnt[11]={};
	rep(i,n) rep(j,3) {
		int a; scanf("%d",&a);
		cnt[a]++;
	}

	int ans=0,sum=0;
	rep(x,11) ans+=cnt[x]/2, sum+=cnt[x]%2;
	ans+=sum/4;
	printf("%d\n",ans);

	return 0;
}
0