結果

問題 No.2233 Average
ユーザー umimelumimel
提出日時 2023-03-03 21:52:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 58 ms / 2,000 ms
コード長 704 bytes
コンパイル時間 2,039 ms
コンパイル使用メモリ 166,416 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-18 01:52:32
合計ジャッジ時間 3,358 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 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 35 ms
4,348 KB
testcase_09 AC 52 ms
4,348 KB
testcase_10 AC 41 ms
4,348 KB
testcase_11 AC 40 ms
4,348 KB
testcase_12 AC 35 ms
4,348 KB
testcase_13 AC 10 ms
4,348 KB
testcase_14 AC 30 ms
4,348 KB
testcase_15 AC 39 ms
4,348 KB
testcase_16 AC 13 ms
4,348 KB
testcase_17 AC 15 ms
4,348 KB
testcase_18 AC 58 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
#define drep(i, cc, n) for (int i = (cc); i <= (n); ++i)
#define rep(i, n) drep(i, 0, n - 1)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define fi first
#define se second

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    ll t; cin >> t;
    while(t--){
        ll a, b, c, k; cin >> a >> b >> c >> k;
        while(k--){
            if(a == b && b == c && c == a) break;
            ll pre_a = a, pre_b = b, pre_c = c;
            a = (pre_b+pre_c)/2;
            b = (pre_c+pre_a)/2;
            c = (pre_a+pre_b)/2;
        }

        cout << a+b+c << '\n';
    }
}
0