結果

問題 No.920 あかあお
ユーザー y61mpnl
提出日時 2020-10-04 14:39:38
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 351 bytes
コンパイル時間 188 ms
コンパイル使用メモリ 39,916 KB
最終ジャッジ日時 2025-01-15 02:43:16
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
        a = 0;
    }else{
        ans += z;
        a -= z;
        z = 0;
    }
    ans += z/2;
    printf("%d\n", ans);
    return 0;
}
0