結果

問題 No.571 3人兄弟(その2)
ユーザー pinpin
提出日時 2017-10-06 23:42:05
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,069 bytes
コンパイル時間 1,610 ms
コンパイル使用メモリ 68,684 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-08-10 17:36:36
合計ジャッジ時間 1,431 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,384 KB
testcase_10 AC 1 ms
4,384 KB
testcase_11 AC 1 ms
4,384 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm> 
#include <queue>
#include <functional>
#include <map>
#include <string>
using namespace std;

typedef long long ll;



int main(void){

    int A, B, C, wa, wb, wc;
    cin >> A >> wa >> B >> wb >> C >> wc;
    int a[3] = { A, B, C };
    int w[3] = { wa, wb, wc };
    
    for (int i = 0; i < 3; i++){
        for (int j = 0; j < 2; j++){
            if (a[j + 1] <= a[j]){
                swap(a[j], a[j + 1]);

                
                if (a[j + 1] == a[j]){
                    if (w[j+1] < w[j]){
                        swap(a[j], a[j + 1]);
                        continue;
                    }
                }

                swap(w[j], w[j + 1]);
                
            }
        }
    }

    for (int i = 2; i >= 0; i--){
        if (a[i] == A&&w[i] == wa){
            cout << 'A' << endl;
        }
        else if (a[i] == B&&w[i]== wb){
            cout << 'B' << endl;
        }
        else if (a[i] == C&&w[i] == wc){
            cout << 'C' << endl;
        }
    }




}
0