結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー RCCW
提出日時 2017-02-10 00:26:26
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 700 bytes
コンパイル時間 1,292 ms
コンパイル使用メモリ 159,444 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 02:36:41
合計ジャッジ時間 1,942 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(void) {
	string a, b;
	cin>>a>>b;
	if((a.length()!=1&&a[0]=='0')||(b.length()!=1&&b[0]=='0')){cout<<"NG"<<endl;return 0;}
	   string str(a);
	    int num = std::atoi(str.c_str());
	    if(num>12345){
			cout<<"NG"<<endl;
			return 0;
	    }

	    string strb(b);
	    	    int numb = std::atoi(strb.c_str());
	    	    if(numb>12345){
	    			cout<<"NG"<<endl;
	    			return 0;
	    	    }

	for (int i = 0; i < a.length(); ++i) {

		if(a[i]>=48&&a[i]<=57){

		}else{
		cout<<"NG"<<endl;
		return 0;
		}
	}
	for (int i = 0; i < b.length(); ++i) {
		if(b[i]>=48&&b[i]<=57){

		}else{
		cout<<"NG"<<endl;
		return 0;
		}
	}
	cout<<"OK"<<endl;
}
0