結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー tossytossy
提出日時 2016-11-18 23:34:25
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,132 bytes
コンパイル時間 698 ms
コンパイル使用メモリ 88,464 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-17 12:11:49
合計ジャッジ時間 1,488 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0