結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー runom
提出日時 2016-11-24 14:45:46
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 442 bytes
コンパイル時間 530 ms
コンパイル使用メモリ 58,356 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-27 10:32:23
合計ジャッジ時間 1,388 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <string>

using namespace std;

bool ok(const string& s) {
    return all_of(s.begin(), s.end(),
                  [](char ch) { return '0' <= ch && ch <= '9'; }) &&
           (s[0] != '0' || s.length() == 1) && (stoi(s) <= 12345);
}

int main() {
    string a, b;
    cin >> a >> b;

    if (ok(a) && ok(b)) {
        cout << "OK" << endl;
    } else {
        cout << "NG" << endl;
    }
}
0