結果

問題 No.29 パワーアップ
ユーザー t_murano
提出日時 2014-11-25 18:04:28
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 483 bytes
コンパイル時間 616 ms
コンパイル使用メモリ 63,548 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2025-01-02 21:53:42
合計ジャッジ時間 1,591 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:21:12: warning: ‘up’ is used uninitialized [-Wuninitialized]
   21 |         up += items[i] / 2;
      |         ~~~^~~~~~~~~~~~~~~
main.cpp:12:9: note: ‘up’ was declared here
   12 |     int up, tmp;
      |         ^~
main.cpp:22:13: warning: ‘tmp’ is used uninitialized [-Wuninitialized]
   22 |         tmp += items[i] % 2;
      |         ~~~~^~~~~~~~~~~~~~~
main.cpp:12:13: note: ‘tmp’ was declared here
   12 |     int up, tmp;
      |             ^~~

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;

int items[11];

int main() {
    int n;
    int a, b, c;
    int up, tmp;
    cin >> n;
    REP(i, n) {
        cin >> a >> b >> c;
        items[a]++;
        items[b]++;
        items[c]++;
    }
    REP(i, 11) {
        up += items[i] / 2;
        tmp += items[i] % 2;
    }
    up += tmp / 4;
    cout << up << endl;
    return 0;
}
0