結果

問題 No.920 あかあお
ユーザー y61mpnl
提出日時 2020-10-04 14:37:52
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 275 bytes
コンパイル時間 238 ms
コンパイル使用メモリ 40,232 KB
最終ジャッジ日時 2025-01-15 02:43:12
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |     scanf("%d %d %d", &x, &y, &z);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<cstdio>
#include<cstdlib>
#include<algorithm>

int main(){
    int x, y, z;
    scanf("%d %d %d", &x, &y, &z);

    int a = abs(x-y), ans = std::min(x, y);
    if(a<=z){
        ans += a;
        z -= a;
    }
    ans += z/2;
    printf("%d\n", ans);
    return 0;
}
0