結果

問題 No.2233 Average
ユーザー ShadowMas
提出日時 2025-09-28 18:10:49
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 516 bytes
コンパイル時間 1,927 ms
コンパイル使用メモリ 193,196 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-09-28 18:10:53
合計ジャッジ時間 3,899 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘void solve()’:
main.cpp:8:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |   scanf("%lld%lld%lld%lld", &A, &B, &C, &K);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp: In function ‘int main()’:
main.cpp:24:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   24 |   scanf("%d", &T);
      |   ~~~~~^~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int T;
LL A, B, C, K;
void solve()
{
  scanf("%lld%lld%lld%lld", &A, &B, &C, &K);
  while (K--)
  {
    LL tA = B + C >> 1, tB = A + C >> 1, tC = A + B >> 1;
    A = tA, B = tB, C = tC;
    if (A == B && B == C)
      break;
  }
  printf("%lld\n", A + B + C);
}
int main()
{
#ifndef ONLINE_JUDGE
  freopen("data/data1.in", "r", stdin);
  // freopen("data/data1.out", "w", stdout);
#endif
  scanf("%d", &T);
  while (T--)
    solve();
  return 0;
}
0