結果

問題 No.138 化石のバージョン
ユーザー teramura
提出日時 2016-06-11 17:02:39
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 1,019 bytes
コンパイル時間 465 ms
コンパイル使用メモリ 57,068 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-09 12:55:04
合計ジャッジ時間 1,769 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include<string>
using namespace std;

int main()
{
    string ver_K,ver_N;
    cin>>ver_K;
    cin>>ver_N;

    if(ver_K.substr(0,ver_K.find(".")) < ver_N.substr(0,ver_N.find("."))){
        cout<<"NO"<<endl;
        return 0;
    }
    else if(ver_K.substr(0,ver_K.find(".")) > ver_N.substr(0,ver_N.find("."))){
        cout<<"YES"<<endl;
        return 0;
    }


    if(ver_K.substr(ver_K.find(".")+1,ver_K.rfind(".")-ver_K.find(".")) < ver_N.substr(ver_N.find(".")+1,ver_N.rfind(".")-ver_N.find("."))){
        cout<<"NO"<<endl;
        return 0;
    }
    else if(ver_K.substr(ver_K.find(".")+1,ver_K.rfind(".")-ver_K.find(".")) > ver_N.substr(ver_N.find(".")+1,ver_N.rfind(".")-ver_N.find("."))){
        cout<<"YES"<<endl;
        return 0;
    }


    if(ver_K.substr(ver_K.rfind(".")+1) < ver_N.substr(ver_N.rfind(".")+1)){
        cout<<"NO"<<endl;
    }
    else if(ver_K.substr(ver_K.rfind(".")+1) > ver_N.substr(ver_N.rfind(".")+1)){
        cout<<"YES"<<endl;
    }


    return 0;
}
0