結果
問題 | No.446 ゆきこーだーの雨と雪 (1) |
ユーザー | gigime |
提出日時 | 2016-11-18 22:32:12 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 892 bytes |
コンパイル時間 | 1,179 ms |
コンパイル使用メモリ | 144,928 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-08-17 11:01:48 |
合計ジャッジ時間 | 1,998 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,380 KB |
testcase_01 | AC | 2 ms
4,380 KB |
testcase_02 | AC | 2 ms
4,376 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 1 ms
4,376 KB |
testcase_05 | AC | 2 ms
4,380 KB |
testcase_06 | AC | 2 ms
4,376 KB |
testcase_07 | AC | 1 ms
4,376 KB |
testcase_08 | AC | 2 ms
4,376 KB |
testcase_09 | AC | 2 ms
4,380 KB |
testcase_10 | AC | 2 ms
4,376 KB |
testcase_11 | AC | 1 ms
4,380 KB |
testcase_12 | AC | 1 ms
4,380 KB |
testcase_13 | AC | 1 ms
4,380 KB |
testcase_14 | AC | 1 ms
4,376 KB |
testcase_15 | AC | 1 ms
4,380 KB |
testcase_16 | AC | 1 ms
4,376 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; #define FOR(i,l,r) for(int i = (l);i < (r);i++) #define ALL(x) (x).begin(),(x).end() template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;} template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;} typedef long long ll; int N,M; string A,B; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cin >> A >> B; N = A.size(); M = B.size(); bool ok = true; FOR(i,0,N){ if(A [i] < '0' || '9' < A [i]){ ok = false; } } FOR(i,0,M){ if(B [i] < '0' || '9' < B [i]){ ok = false; } } if(A.front() == '0' && N != 1){ ok = false; } if(B.front() == '0' && M != 1){ ok = false; } if(ok && (stoi(A) < 0 || stoi(A) > 12345)){ ok = false; } if(ok && (stoi(B) < 0 || stoi(B) > 12345)){ ok = false; } cout << (ok ? "OK" : "NG") << endl; return 0; }