結果

問題 No.920 あかあお
ユーザー Maeda
提出日時 2025-03-25 16:55:17
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 453 bytes
コンパイル時間 357 ms
コンパイル使用メモリ 24,192 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-25 16:55:18
合計ジャッジ時間 791 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 3
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |     scanf("%d %d %d",&a,&b,&c);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

void main(void){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    int purple = 0,shortage = 0;
    if(a > b){
        shortage = a - b ;
        purple = b;
    }else if( b > a ){
        shortage = b - a ;
        purple = a;
    }

    c -= shortage;
    if(c < 0){
        c = 0;
        shortage = 0;
    }
    purple += c/2;
    if(shortage < 0){
        shortage = 0;
    }
    purple += shortage;
    printf("%d",purple);

}
0