結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー rtomp
提出日時 2016-11-22 19:29:49
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 624 bytes
コンパイル時間 418 ms
コンパイル使用メモリ 57,428 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-27 09:41:24
合計ジャッジ時間 1,050 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 10 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

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

const string _Limit = "12345";

bool Juge(string target)
{
	// 2桁以上で先頭が"0"は失格
	if (target.length() != 1 && target[0] == '0') return false;

	// 0-9以外が含まれていたら失格
	for (string::const_iterator i = target.begin(); i != target.end(); i++)
	{
		if (*i < '0' || *i > '9') return false;
	}

	// 辞書順比較で失格判定
	if (target > _Limit) return false;

	return true;
}

void Slove()
{
	string a, b;
	cin >> a >> b;

	bool ans = (Juge(a) && Juge(b));

	cout << (ans ? "OK" : "NG") << endl;
}


int main()
{
	Slove();
}
0