結果
問題 | No.2233 Average |
ユーザー |
|
提出日時 | 2023-03-03 23:38:00 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 62 ms / 2,000 ms |
コード長 | 482 bytes |
コンパイル時間 | 2,035 ms |
コンパイル使用メモリ | 190,972 KB |
最終ジャッジ日時 | 2025-02-11 04:45:11 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 18 |
コンパイルメッセージ
main.cpp: In function ‘void solve()’: 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); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#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) >> 1, (c + a) >> 1, (a + b) >> 1, 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();}}