結果

問題 No.571 3人兄弟(その2)
ユーザー Kainogi_Kainogi_
提出日時 2017-10-27 07:48:27
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 489 bytes
コンパイル時間 362 ms
コンパイル使用メモリ 52,216 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-14 02:40:46
合計ジャッジ時間 1,101 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
using namespace std;
struct P{char suit;int h;int w;};
int main(void){
    struct P p[4];
    int i,j;
    p[0].suit='A',p[1].suit='B',p[2].suit='C';
    for(i=0;i<3;i++){
        cin>>p[i].h>>p[i].w;
    }
    for(i=0;i<2;i++){
        for(j=2;j>i;j--){
            if(p[j].h>p[j-1].h)swap(p[j],p[j-1]);
            else if(p[j].h==p[j-1].h&&p[j].w<p[j-1].w)swap(p[j],p[j-1]);
        }
    }
    for(i=0;i<3;i++){
        cout<<p[i].suit<<endl;
    }
    return 0;
}
0