結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー hiragn
提出日時 2019-07-19 03:53:13
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 527 bytes
コンパイル時間 1,652 ms
コンパイル使用メモリ 166,604 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-25 23:48:41
合計ジャッジ時間 2,515 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

bool solve(string s) {
    //リーディングゼロ
    if (s.length() != 1 and s[0] == '0') {
        return false;
    }

    //数字以外
    for (char i : s) {
        if (i < '0' or i > '9') {
            return false;
        }
    }

    //最大値
    return (stoi(s) <= 12345);
}

int main() {
    string s1, s2;
    cin >> s1 >> s2;

    if (solve(s1) and solve(s2)) {
        cout << "OK" << endl;
    } else {
        cout << "NG" << endl;
    }
    return 0;
}
0