結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー nksk38
提出日時 2017-07-01 11:12:00
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 868 bytes
コンパイル時間 777 ms
コンパイル使用メモリ 75,952 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-05 03:25:01
合計ジャッジ時間 1,398 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

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