結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー Naoyk1212Naoyk1212
提出日時 2016-11-18 22:46:01
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 755 bytes
コンパイル時間 1,070 ms
コンパイル使用メモリ 146,936 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-17 11:15:59
合計ジャッジ時間 1,844 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,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

bool suuji(string str){
	bool num = true;
	for(int i = 0; i < str.length(); i++){
		if(str[i] - '0' >= 0 && str[i] - '0' <= 9){
			if(str.length() == 1 && str[i] - '0' == 0){
				break;
			}else if(i == 0 && str[i] - '0' == 0){
				num = false;
				break;
			}
		}else{
			num = false;
			break;
		}
	}
	return num;
}

int StringToInt(string str){
  stringstream ss;
  ss << str;
  int num;
  ss >> num;
  return num;
}

int main(){
	string a, b;
	cin >> a >> b;
	if(suuji(a) == true && suuji(b) == true){
		int n = StringToInt(a);
		int m = StringToInt(b);
		if(n >= 0 && n <= 12345 && m >= 0 && m <= 12345){
			cout << "OK" << endl;
		}else{
			cout << "NG" << endl;
		}
	}else{
		cout << "NG" << endl;
	}
}
0