結果

問題 No.653 E869120 and Lucky Numbers
コンテスト
ユーザー face4
提出日時 2018-11-01 10:08:39
言語 C++14
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 821 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 319 ms
コンパイル使用メモリ 79,592 KB
実行使用メモリ 9,920 KB
最終ジャッジ日時 2026-09-26 16:52:08
合計ジャッジ時間 2,103 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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