結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー KKT89KKT89
提出日時 2019-09-16 03:28:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 991 bytes
コンパイル時間 610 ms
コンパイル使用メモリ 74,272 KB
実行使用メモリ 4,992 KB
最終ジャッジ日時 2023-09-21 04:22:07
合計ジャッジ時間 1,458 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
typedef long long int ll;

int main(){
    string s,t; cin >> s >> t;
    bool ok=true;
    int n=s.size(); int m=t.size();
    if(s[0]=='0'&&n>1){
        ok=false;
    }
    if(t[0]=='0'&&m>1){
        ok=false;
    }
    for(int i=0;i<n;i++){
        if('0'<=s[i]&&s[i]<='9'){
            continue;
        }
        else{
            ok=false;
        }
    }
    for(int i=0;i<m;i++){
        if('0'<=t[i]&&t[i]<='9'){
            continue;
        }
        else{
            ok=false;
        }
    }
    if(n==5){
        int q=0;
        for(int i=0;i<5;i++){
            q+=(s[i]-'0')*pow(10,4-i);
        }
        if(q>12345)ok=false;
    }
    if(m==5){
        int q=0;
        for(int i=0;i<5;i++){
            q+=(t[i]-'0')*pow(10,4-i);
        }
        if(q>12345)ok=false;
    }
    if(ok){
        cout << "OK" << endl;
    }
    else{
        cout << "NG" << endl;
    }
}
0