結果

問題 No.138 化石のバージョン
ユーザー Pachicobue
提出日時 2017-10-25 00:18:40
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 1,196 bytes
コンパイル時間 1,982 ms
コンパイル使用メモリ 169,176 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-29 14:36:40
合計ジャッジ時間 2,993 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define show(x) cerr << #x << " = " << x << endl

using namespace std;
using ll = long long;

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
    os << "sz:" << v.size() << "\n[";
    for (const auto& p : v) {
        os << p << ",";
    }
    os << "]\n";
    return os;
}

template <typename S, typename T>
ostream& operator<<(ostream& os, const pair<S, T>& p)
{
    os << "(" << p.first << "," << p.second
       << ")";
    return os;
}


constexpr ll MOD = (ll)1e9 + 7LL;

template <typename T>
constexpr T INF = numeric_limits<T>::max() / 64;

constexpr int MAX = 101;
int parse(const string& s)
{
    vector<string> num(3);
    int pos = 2;
    for (const char c : s) {
        if (c == '.') {
            pos--;
        } else {
            num[pos].push_back(c);
        }
    }
    int sum = 0;
    for (int i = 2; i >= 0; i--) {
        sum += stoi(num[i]) * pow(MAX, i);
    }
    return sum;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s1, s2;
    cin >> s1 >> s2;
    if (parse(s2) <= parse(s1)) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}
0