結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー HO_RI1991HO_RI1991
提出日時 2016-11-18 22:32:31
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,281 bytes
コンパイル時間 767 ms
コンパイル使用メモリ 100,764 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-17 11:01:55
合計ジャッジ時間 1,626 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,380 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 #

#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<algorithm>
#include<list>
#include<cmath>
#include<iomanip>
#include<queue>
#include<functional>
#include<climits>
#include<iterator>
#include<unordered_set>
#include<unordered_map>
#include<map>
#include<stack>
#include<set>
#include<sstream>
using namespace std;

const double pi=4*atan(1.0);

constexpr long long mod=static_cast<long long>(1e9+7);

using cWeightEdges=vector<vector<pair<int,int>>>;
using cEdges=vector<vector<int>>;

int main(){
	string A,B;

	cin>>A>>B;
	
	bool ans=true;
	for(const auto& val:A){
		if(!('0' <= val && val <= '9')){
			ans=false;
			break;
		}
	}

	if(ans){
		for(const auto& val:B){
			if(!('0' <= val && val <= '9')){
				ans=false;
				break;
			}
		}
	}

	if(ans){
		bool is_zero_leading=false;
		if(A.size()>1 && (A[0] == '0')){
			is_zero_leading=true;
		}
		if(B.size()>1 && (B[0] == '0')){
			is_zero_leading=true;
		}
		if(is_zero_leading)ans=false;
	}

	if(ans){
		stringstream sstream;
		sstream<<A;
		int x;
		sstream>>x;
		if(!(0<=x && x<=12345))ans=false;
	}
	if(ans){
		stringstream sstream;
		sstream<<B;
		int x;
		sstream>>x;
		if(!(0<=x && x<=12345))ans=false;
	}

	if(ans)cout<<"OK"<<endl;
	else cout<<"NG"<<endl;
	//system("pause");
	return 0;
}
0