結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー ouoz1Vouoz1V
提出日時 2016-11-18 23:47:29
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 773 bytes
コンパイル時間 551 ms
コンパイル使用メモリ 67,848 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-04 18:59:43
合計ジャッジ時間 1,207 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<cmath>
#include<vector>
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');
    double inta=0,intb=0;
    vector<int> aa,ba;
    for(int i=0; i<A.length(); i++){
        if(A[i]<'0'||A[i]>'9')ng=false;
        aa.push_back(A[i]-'0');
    }
    for(int i=0; i<B.length(); i++){
        if(B[i]<'0'||B[i]>'9')ng=false;
        ba.push_back(B[i]-'0');
    }
    for(int i=aa.size()-1; i>=0; i--){
        inta+=aa[i]*pow(10.0,fabs(i-4));
    }
    for(int i=ba.size()-1; i>=0; i--){
        intb+=ba[i]*pow(10.0,fabs(i-4));
    }
    cout<<inta<<endl;
    cout<<((ng&&inta<=12345&&intb<=12345)?("OK"):("NG"))<<endl;
    return 0;
}

0