結果

問題 No.2233 Average
ユーザー Carpenters-Cat
提出日時 2023-03-03 23:10:40
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 478 bytes
コンパイル時間 1,948 ms
コンパイル使用メモリ 191,444 KB
最終ジャッジ日時 2025-02-11 04:19:10
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 1
other RE * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘void solve()’:
main.cpp:15:16: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 2 has type ‘ll’ {aka ‘long long int’} [-Wformat=]
   15 |     scanf(" %lld %lld %lld %lld", a, b, c, k);
      |             ~~~^                  ~
      |                |                  |
      |                long long int*     ll {aka long long int}
main.cpp:15:21: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 3 has type ‘ll’ {aka ‘long long int’} [-Wformat=]
   15 |     scanf(" %lld %lld %lld %lld", a, b, c, k);
      |                  ~~~^                ~
      |                     |                |
      |                     long long int*   ll {aka long long int}
main.cpp:15:26: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 4 has type ‘ll’ {aka ‘long long int’} [-Wformat=]
   15 |     scanf(" %lld %lld %lld %lld", a, b, c, k);
      |                       ~~~^              ~
      |                          |              |
      |                          long long int* ll {aka long long int}
main.cpp:15:31: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 5 has type ‘ll’ {aka ‘long long int’} [-Wformat=]
   15 |     scanf(" %lld %lld %lld %lld", a, b, c, k);
      |                            ~~~^            ~
      |                               |            |
      |                               |            ll {aka long long int}
      |                               long long int*
main.cpp:15:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |     scanf(" %lld %lld %lld %lld", a, b, c, k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:15:10: warning: ‘a’ is used uninitialized [-Wuninitialized]
   15 |     scanf(" %lld %lld %lld %lld", 

ソースコード

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