結果
問題 | No.446 ゆきこーだーの雨と雪 (1) |
ユーザー | tossy |
提出日時 | 2016-11-18 23:34:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,132 bytes |
コンパイル時間 | 750 ms |
コンパイル使用メモリ | 92,284 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-26 08:40:45 |
合計ジャッジ時間 | 1,415 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 13 |
ソースコード
#include <cstdio> #include <cstring> #include <string> #include <cmath> #include <cassert> #include <iostream> #include <algorithm> #include <stack> #include <queue> #include <vector> #include <set> #include <map> #include <bitset> #include <functional> using namespace std; #define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repl(i,0,n) #define mp(a,b) make_pair((a),(b)) #define pb(a) push_back(a) #define all(x) (x).begin(),(x).end() #define dbg(x) cout<<#x"="<<(x)<<endl #define fi first #define se second #define INF 2147483600 bool isvalid(string str){ if(str.size()==0) return false; if(str.size()==1){ if(str[0]=='0') return true; else return false; } if(str.size()>=6) return false; if(str[0]<'0' || str[0]>'9') return false; int idx=1, n=str[0] - '0'; while(n!=0 && idx<str.size()){ if(str[idx]<'0' || str[idx]>'9') return false; n = n*10 + str[idx] - '0'; idx++; } if(n!=0 && n<=12345) return true; else return false; } int main(){ string s1,s2; cin>>s1>>s2; if(isvalid(s1) && isvalid(s2)) cout<<"OK"<<endl; else cout<<"NG"<<endl; return 0; }