結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー ga0oga0o
提出日時 2017-01-02 20:01:11
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,317 bytes
コンパイル時間 606 ms
コンパイル使用メモリ 71,588 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-22 09:29:45
合計ジャッジ時間 1,336 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <string>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
using namespace std;
#define len(n) (int)n.length()
#define dump cout
#define pb push_back
#define ll long long
#define make_pair mkp
typedef pair<ll, ll> LLARR;

int main()
{
    ios::sync_with_stdio(false);
  
    string s[2];
    cin >> s[0];
    cin >> s[1];

    bool isOK = true;
    for (int i = 0; i < 2; i++)
    {
        bool nA = true;
        for (int k = 0; k < len(s[i]); k++)
        {
            if ((s[i][k] >= '1') && (s[i][k] <= '9'))
            {
                nA = false;
            }
            else if (s[i][k] == '0')
            {
                if (nA && (len(s[i]) > 1))
                {
                    isOK = false;
                    break;
                }
            }
            else
            {
                isOK = false;
                break;
            }
        }
        if (isOK)
        {
            int tmp = stoi(s[i]);
            if ((0 > tmp) || ( tmp > 12345))
                isOK = false;
        }
    }

    if (!isOK)
    {
        cout << "NG" << endl;
    }
    else
    {
        cout << "OK" << endl;
    }

    return 0;
}
0