結果

問題 No.570 3人兄弟(その1)
ユーザー ElkElk
提出日時 2018-05-27 00:55:25
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 580 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 25,116 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-11 03:45:42
合計ジャッジ時間 783 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:18:15: warning: ‘max_cnt’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         }else if(max_cnt == 1){
               ^~

ソースコード

diff #

#include <stdio.h>

int main(){
    int brother[3];
    int i, j, max = 0, max_cnt;

    scanf("%d%d%d", &brother[0], &brother[1], &brother[2]);

    for(i = 0; i < 3; i++){
        for(j = 0; j < 3; j++){
            if(max <= brother[j]){
                max = brother[j];
                max_cnt = j;
            }
        }
        if(max_cnt == 0){
            printf("A\n");
        }else if(max_cnt == 1){
            printf("B\n");
        }else if(max_cnt == 2){
            printf("C\n");
        }
        brother[max_cnt] = 0;
        max = 0;
    }

    return 0;

}
0