結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー gamer0819
提出日時 2019-06-09 20:06:09
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 795 bytes
コンパイル時間 581 ms
コンパイル使用メモリ 56,892 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-06 00:15:46
合計ジャッジ時間 1,024 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 9 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <stdexcept>
using namespace std;

int main(void) {
    string s[2];
    cin >> s[0] >> s[1];
    int n[10] = {0,1,2,3,4,5,6,7,8,9};
    for (int k=0; k<2; k++){
        for (int i=0; i < s[k].size(); i++) {
            bool checked = false;
            for (int j=0; j < 10; j++) {
                if (s[k][i] == n[i]+'0') {
                    checked = true;
                    break;
                }
            }
            if (!checked) {
                cout << "NG" << endl;
                return 0;
            }
        }
    }
    int ai, bi;
    ai = stoi(s[0]);
    bi = stoi(s[1]);
    if (ai>12345 || ai<0 || bi>12345 || bi<0) {
        cout << "NG" << endl;
    }
    else {
        cout << "OK" << endl;
    }


    return 0;
}
0