結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー ouoz1Vouoz1V
提出日時 2016-11-18 22:51:06
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 511 bytes
コンパイル時間 498 ms
コンパイル使用メモリ 57,020 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-04 18:03:53
合計ジャッジ時間 1,156 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
using namespace std;

int main(){
    string A,B;
    cin>>A>>B;
    bool ng=(A.length()<=5)&&(B.length()<=5)||!(A.length()>1&&A[0]=='0')||!(B.length()>1&&B[0]=='0');
    bool sizeng=true;
    for(int i=0; i<A.length(); i++){
        if(A[i]<'0'||A[i]>'9')ng=false;
        if(sizeng)sizeng|=A[i]<=i+1;
    }
    for(int i=0; i<B.length(); i++){
        if(B[i]<'0'||B[i]>'9')ng=false;
        if(sizeng)sizeng|=B[i]<=i+1;
    }
    cout<<((ng&&sizeng)?("OK"):("NG"))<<endl;
    return 0;
}

0