結果
問題 | No.446 ゆきこーだーの雨と雪 (1) |
ユーザー |
![]() |
提出日時 | 2016-12-27 22:41:01 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,119 bytes |
コンパイル時間 | 991 ms |
コンパイル使用メモリ | 93,892 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-15 04:52:57 |
合計ジャッジ時間 | 1,490 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 13 |
ソースコード
#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 100000char 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;}