結果

問題 No.570 3人兄弟(その1)
ユーザー conankun
提出日時 2017-10-13 22:22:25
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 795 bytes
コンパイル時間 473 ms
コンパイル使用メモリ 54,100 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-17 11:33:33
合計ジャッジ時間 932 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>

using namespace std;

int max2(int x, int y) {
    return x > y ? x : y;
}

int max3(int x, int y, int z) {
    x = max2(x, y);
    return max2(x, z);
}

int min2(int x, int y) {
    return x < y ? x : y;
}

int min3(int x, int y, int z) {
    x = min2(x, y);
    return min2(x, z);
}

int main() {
    int a, b, c;
    cin >> a;
    cin >> b;
    cin >> c;

    int heighest = max3(a, b, c);
    int shortest = min3(a, b, c);;

    cout << (heighest == a ? "A" : (heighest == b ? "B" : "C")) << "\n";
    cout << ((heighest != a && shortest != a) ? "A" : ((heighest != b && shortest != b) ? "B" : "C")) << "\n";
    cout << (shortest == a ? "A" : (shortest == b ? "B" : "C")) << "\n";

    cin >> a;

    return 0;
}
0