結果

問題 No.2233 Average
ユーザー Carpenters-CatCarpenters-Cat
提出日時 2023-03-03 23:10:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 478 bytes
コンパイル時間 1,893 ms
コンパイル使用メモリ 200,876 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-18 00:19:28
合計ジャッジ時間 5,640 ms
ジャッジサーバーID
(参考情報)
judge6 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'void solve()':
main.cpp:15:10: warning: 'a' is used uninitialized [-Wuninitialized]
   15 |     scanf(" %lld %lld %lld %lld", a, b, c, k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:14:8: note: 'a' was declared here
   14 |     ll a, b, c, k;
      |        ^
main.cpp:15:10: warning: 'b' is used uninitialized [-Wuninitialized]
   15 |     scanf(" %lld %lld %lld %lld", a, b, c, k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:14:11: note: 'b' was declared here
   14 |     ll a, b, c, k;
      |           ^
main.cpp:15:10: warning: 'c' is used uninitialized [-Wuninitialized]
   15 |     scanf(" %lld %lld %lld %lld", a, b, c, k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:14:14: note: 'c' was declared here
   14 |     ll a, b, c, k;
      |              ^
main.cpp:15:10: warning: 'k' is used uninitialized [-Wuninitialized]
   15 |     scanf(" %lld %lld %lld %lld", a, b, c, k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:14:17: note: 'k' was declared here
   14 |     ll a, b, c, k;
      |                 ^

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll calc(ll a, ll b, ll c, ll k) {
    if (k == 0) {
        return a + b + c;
    }
    if (a == b && b == c) {
        return a * 3;
    }
    return calc((b+c) >> 2, (c + a) >> 2, (a + b) >> 2, k - 1);
}
void solve() {
    ll a, b, c, k;
    scanf(" %lld %lld %lld %lld", a, b, c, k);
    printf("%lld\n", calc(a, b, c, k));
}
int main () {
    int n;
    cin >> n;
    while (n--) {
        solve();
    }
}
0