結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー yicodeyicode
提出日時 2023-06-12 10:59:35
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 944 bytes
コンパイル時間 1,479 ms
コンパイル使用メモリ 165,900 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-02 07:06:02
合計ジャッジ時間 2,316 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
int main() {
  string S; cin >> S;
  string T; cin >> T;
  string alpha = "0123456789";
  int a = 0;
  int b = 0;
  int za = 0;
  int zb = 0;
  for(int i = 0;i < S.size(); i++) {
    bool fire = false;
    for(int j = 0; j < alpha.size(); j++) {
      if(alpha[j] == S[i]) {
        fire = true;
      }
    }
    if(fire) {
      a++;
    }
    if('0' == S[0] && i != S.size() - 1) {
      za++;
    }
  }
  for(int i = 0;i < T.size(); i++) {
    bool fire = false;
    for(int j = 0; j < alpha.size(); j++) {
      if(alpha[j] == T[i]) {
        fire = true;
      }
    }
    if(fire) {
      b++;
    }
    if('0' == T[0] && i != T.size() - 1) {
      zb++;
    }
  }

  if(a == S.size() && b == T.size() && za == 0 && zb == 0 && stoi(S) <= 12345 && stoi(T) <= 12345) {
    cout << "OK" << endl;
  }else {
    cout << "NG" << endl;
  }
}
0