結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー kpinkcatkpinkcat
提出日時 2023-08-15 19:57:12
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 885 bytes
コンパイル時間 842 ms
コンパイル使用メモリ 103,988 KB
最終ジャッジ日時 2025-02-16 08:26:29
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 RE * 1
other AC * 10 RE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>
#include<cctype>
#include<set>
#include<bitset>
#include<math.h>
#include<map>
#include<queue>
#include<iomanip>
using namespace std;
#ifdef _WIN32
#include <Windows.h>
#endif

int main()
{
    string a;
    bool ok = false;
    for (int i = 0; i < 2; i++){
        cin >> a;
        if ((a.size() > 5) || (stoi(a) > 12345)){
            cout << "NG" << endl;
            return 0;
        }
        for (int j = 0; j < a.size(); j++){
            if (a[j] < '0' || a[j] > '9'){
                cout << "NG" << endl;
                return 0;
            }
            if ((a[j] >= '1' && a[j] <='9') || (a[j] == '0' && a.size() == 1))ok = true;
            if ((a[j] == '0') && (!ok)){
                cout << "NG" << endl;
                return 0;
            }
        }
        ok = false;
    }
    cout << "OK" << endl;
}
0