結果

問題 No.138 化石のバージョン
ユーザー gemy
提出日時 2023-09-17 02:39:58
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,047 bytes
コンパイル時間 2,372 ms
コンパイル使用メモリ 223,036 KB
最終ジャッジ日時 2025-02-16 23:06:05
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define repp(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define all(v) begin(v), end(v)
using namespace std;
using ll = long long int;

vector<int> split(string s) {
    vector<int> v;
    string t = "";
    for (const auto& c : s) {
        if (c != '.') { t += c; }
        else { v.push_back(stoi(t)); t = ""; }
    }
    if (t != "") v.push_back(stoi(t));
    return v;
}

int main() {
    // 入力
    string S, T;
    cin >> S >> T;
    vector<int> A = split(S), a = split(T);

    // 判定
    bool isFuel = true;
    if (a[0] < A[0]) { isFuel = true; }
    else if (a[0] > A[0]) { isFuel = false; }
    else {
        if (a[1] < A[1]) { isFuel = true; }
        else if (a[1] > A[1]) { isFuel = false; }
        else {
            if (a[2] < A[2]) { isFuel = true; }
            else if (a[2] > A[2]) { isFuel = false; }
            else { isFuel = true; }
        }
    }

    // 出力
    cout << (isFuel ? "YES" : "NO") << endl;
}
0