結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー ohreitetsu
提出日時 2018-06-17 21:39:15
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 563 bytes
コンパイル時間 554 ms
コンパイル使用メモリ 66,720 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-30 16:36:24
合計ジャッジ時間 1,223 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;
bool NotDigit(string S){
	for (int i=0;i<S.length();i++){
		if (S[i]<'0' || S[i]>'9'){
			return true;
		}
	}
	return false;
}
int main(int argc, char* argv[])
{
	string A,B;
	cin>>A;
	cin>>B;
	if (NotDigit(A) || NotDigit(B)){
		cout<<"NG"<<endl;
		return 0;
	}
	int a1=atol(A.c_str());
	int b1=atol(B.c_str());
	if (a1>12345 || b1>12345){
		cout<<"NG"<<endl;
		return 0;
	}
	if (A.length()>1 && A[0]=='0' || B.length()>1 && B[0]=='0'){
		cout<<"NG"<<endl;
		return 0;	
	}
	cout<<"OK"<<endl;
	return 0;
}
0