結果

問題 No.653 E869120 and Lucky Numbers
ユーザー face4
提出日時 2018-11-01 10:07:10
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 797 bytes
コンパイル時間 878 ms
コンパイル使用メモリ 67,828 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-19 14:56:13
合計ジャッジ時間 1,890 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
using namespace std;

int main(){
    string s;
    cin >> s;

    if(s.length() == 1){
        cout << "No" << endl;
        return 0;
    }

    reverse(s.begin(), s.end());

    int tmp = (s[0]-'0') + 10 * (s[1]-'0');
    
    if(tmp%10 < 2 || tmp%10 > 4){
        cout << "No" << endl;
        return 0;
    }

    tmp = tmp / 10 * 10;
    tmp -= 10;
    tmp /= 10;

    for(int i = 2; i < s.length(); i++){
        if(tmp % 10 < 2 || tmp % 10 > 4){
            cout << "No" << endl;
            return 0;
        }else{
            tmp += 10 * (s[i]-'0');
            tmp = tmp / 10 * 10;
            tmp -= 10;
            tmp /= 10;
        }
    }

    if(tmp == 0)    cout << "Yes" << endl;
    else            cout << "No" << endl;

    return 0;
}
0