結果

問題 No.998 Four Integers
ユーザー ottyajp
提出日時 2020-04-19 20:57:15
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 698 bytes
コンパイル時間 438 ms
コンパイル使用メモリ 54,960 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-06 08:04:09
合計ジャッジ時間 1,256 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 16 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;

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