結果

問題 No.29 パワーアップ
ユーザー Respect2D
提出日時 2014-11-21 01:17:30
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 458 bytes
コンパイル時間 582 ms
コンパイル使用メモリ 58,624 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2025-01-02 19:48:38
合計ジャッジ時間 1,424 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstring>
using namespace std;

int n;
int cnt[10];

int main(){
  while(cin >> n){
    memset(cnt, 0, sizeof(cnt));
    for(int i = 0; i < n; i++){
      for(int j = 0; j < 3; j++){
        int x;
        cin >> x;
        cnt[x - 1]++;
      }
    }

    int ans = 0;

    for(int i = 0; i < 10; i++){
      ans += cnt[i] / 2;
    }
    ans += (n * 3 - ans * 2) / 4;

    cout << ans << endl;
  }
}
0