結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー nksk38nksk38
提出日時 2017-07-01 11:12:00
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 868 bytes
コンパイル時間 741 ms
コンパイル使用メモリ 75,824 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-15 09:54:34
合計ジャッジ時間 1,485 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<cstdio>
#include <iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>

#define mod 1000000007;

using namespace std;
typedef long long ll;
typedef pair<ll, ll> Pr;

string A, B;

int main()
{
	cin >> A >> B;
	for (int i = 0; i < A.size(); i++) {
		if (!(A[i] >= '0' && A[i] <= '9')) {
			cout << "NG" << endl;
			return 0;
		}
	}
	for (int i = 0; i < B.size(); i++) {
		if (!(B[i] >= '0' && B[i] <= '9')) {
			cout << "NG" << endl;
			return 0;
		}
	}
	
	int len_a = A.size(), len_b = B.size();
	string num_a = to_string(stoi(A)), num_b = to_string(stoi(B));
	
	if (len_a != num_a.size() || len_b != num_b.size() || stoi(num_a) > 12345 || stoi(num_b) > 12345) {
		cout << "NG" << endl;
	}
	else
		cout << "OK" << endl;
	return 0;
}
0