結果

問題 No.138 化石のバージョン
ユーザー f843nmfwisfeuw
提出日時 2020-07-28 22:06:59
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,135 bytes
コンパイル時間 1,061 ms
コンパイル使用メモリ 98,596 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 21:00:06
合計ジャッジ時間 1,925 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <string>
#include <map>
#include <iterator>
#include <set>
#include <queue>

using namespace std;

vector<string> split(string s, const string &delimiter) {
    size_t pos_start = 0, pos_end, delim_len = delimiter.length();
    string token;
    vector<string> res;

    while ((pos_end = s.find(delimiter, pos_start)) != string::npos) {
        token = s.substr(pos_start, pos_end - pos_start);
        pos_start = pos_end + delim_len;
        res.push_back(token);
    }

    res.push_back(s.substr(pos_start));
    return res;
}


int main() {

    string s1, s2;
    cin >> s1 >> s2;

    vector<string> ss1 = split(s1, ".");
    vector<string> ss2 = split(s2, ".");
    string result = "YES";
    for (int i = 0; i < 3; ++i) {
        if (stoi(ss1[i]) < stoi(ss2[i])) {
            result = "NO";
            break;
        } else if (stoi(ss1[i]) == stoi(ss2[i])) {
            continue;
        } else {
            break;
        }

    }

    cout << result << endl;


    return 0;
}
0