結果

問題 No.2233 Average
ユーザー jianglyjiangly
提出日時 2023-03-03 21:34:20
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 487 bytes
コンパイル時間 2,340 ms
コンパイル使用メモリ 204,424 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-18 01:29:04
合計ジャッジ時間 3,999 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 37 ms
4,348 KB
testcase_09 AC 55 ms
4,348 KB
testcase_10 AC 44 ms
4,348 KB
testcase_11 AC 42 ms
4,348 KB
testcase_12 AC 37 ms
4,348 KB
testcase_13 AC 10 ms
4,348 KB
testcase_14 AC 32 ms
4,348 KB
testcase_15 AC 42 ms
4,348 KB
testcase_16 AC 13 ms
4,348 KB
testcase_17 AC 16 ms
4,348 KB
testcase_18 AC 62 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using i64 = long long;

void solve() {
    i64 a, b, c, K;
    std::cin >> a >> b >> c >> K;
    
    while ((a != b || b != c) && K > 0) {
        std::tie(a, b, c) = std::tuple((b + c) / 2, (a + c) / 2, (a + b) / 2);
        K--;
    }
    
    std::cout << a + b + c << "\n";
}

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