結果

問題 No.2233 Average
ユーザー tsugutsugutsugutsugu
提出日時 2023-03-03 21:37:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 168 ms / 2,000 ms
コード長 476 bytes
コンパイル時間 1,665 ms
コンパイル使用メモリ 166,648 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-18 01:33:32
合計ジャッジ時間 3,938 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 100 ms
4,348 KB
testcase_09 AC 150 ms
4,348 KB
testcase_10 AC 93 ms
4,348 KB
testcase_11 AC 92 ms
4,348 KB
testcase_12 AC 79 ms
4,348 KB
testcase_13 AC 19 ms
4,348 KB
testcase_14 AC 83 ms
4,348 KB
testcase_15 AC 113 ms
4,348 KB
testcase_16 AC 33 ms
4,348 KB
testcase_17 AC 42 ms
4,348 KB
testcase_18 AC 168 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

void solve() {
    long long a, b, c, k;
    cin >> a >> b >> c >> k;
    while (k--) {
        long long na = (a + b) / 2, nb = (b + c) / 2, nc = (c + a) / 2;
        a = na, b = nb, c = nc;
        if (a == b && b == c) {
            break;
        }
    }
    cout << a + b + c << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
}
0