結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー rtomprtomp
提出日時 2016-11-22 19:29:49
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 624 bytes
コンパイル時間 397 ms
コンパイル使用メモリ 56,796 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-05 12:21:48
合計ジャッジ時間 1,042 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

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