結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー iroha168iroha168
提出日時 2016-12-27 22:41:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,119 bytes
コンパイル時間 732 ms
コンパイル使用メモリ 91,916 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-21 15:49:50
合計ジャッジ時間 1,567 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <functional>
#include <iomanip>
#include <map>

#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;
#define MAX 100000
char ic[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
int main() {
	string a, b;
	bool f = true;
	bool zero = true;
	cin >> a >> b;
	for (int i = 0; i < a.length(); ++i) {
		if (find(ic, ic + 10, a[i]) == end(ic)) {
			f = false;
			break;
		}
		else {
			if (zero) {
				if (i != a.length() - 1 && a[i] == '0') {
					f = false;
					break;

				}
				else {
					zero = false;
				}
			}
		}
	}
	zero = true;
	for (int i = 0; i < b.length() && f; ++i) {
		if (find(ic, ic + 10, b[i]) == end(ic)) {
			f = false;
			break;
		}
		else {
			if (zero) {
				if (i != b.length() - 1 && b[i] == '0') {
					f = false;
					break;

				}
				else {
					zero = false;
				}
			}
		}
	}
	if (f) {
		if (stoi(a) < 0 || stoi(a) > 12345) f = false;
		if (stoi(b) < 0 || stoi(b) > 12345) f = false;
	}
	cout << (f ? "OK" : "NG") << endl;
	return 0;
}
0