結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー rrrrm99
提出日時 2016-11-28 23:43:26
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 446 bytes
コンパイル時間 696 ms
コンパイル使用メモリ 64,256 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-27 12:51:09
合計ジャッジ時間 1,252 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cctype>
#include <cstdlib>

bool ok(std::string s) {
    if(s[0] == '0' && s != "0") return false;
    for(char c : s) {
        if(!std::isdigit(c)) return false;
    }
    if(atoi(s.c_str()) > 12345) return false;
    return true;
}

int main() {
    std::string a, b; std::cin >> a >> b;
    if(ok(a) && ok(b)) {
        std::cout << "OK" << std::endl;
    } else {
        std::cout << "NG" << std::endl;
    }
}
0