結果

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

ソースコード

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 || tmp == 6 || tmp == 7)    cout << "Yes" << endl;
    else            cout << "No" << endl;

    return 0;
}
0