結果

問題 No.998 Four Integers
ユーザー ottyajp
提出日時 2020-04-26 20:28:14
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 668 bytes
コンパイル時間 425 ms
コンパイル使用メモリ 54,732 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-18 07:59:01
合計ジャッジ時間 1,294 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 16 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;

void sort(int *a, int *b, int *c, int *d, bool f) {
    int *buf;
    if (a<b) {
        buf = a;
        a = b;
        b = buf;
        f = true;
    }
    if (b<c) {
        buf = b;
        b = c;
        c = buf;
        f = true;
    }
    if (c<d) {
        buf = c;
        c = d;
        d = buf;
        f = true;
    }
    if (f) {
        return;
    } else {
        sort(a, b, c, d, false);
    }
}

int main() {
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    sort(&a,&b,&c,&d, false);
    
    if (a-b==1 && b-c==1 && c-d==1) {
        cout<<"Yes"<<endl;
    } else {
        cout<<"No"<<endl;
    }
    return 0;
}
0