Codeforces Round #189 (Div. 2) A. Magic Numbers

OpenSoucre發表於2013-06-24
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main(){
    long long n;
    cin >>n;
    while(n){
        if(n%10 == 1) n/=10;
        else if(n%100 == 14 ) n/=100;
        else if(n%1000 == 144) n/=1000;
        else { cout<<"NO"<<endl;return 0;}
    }
    cout<<"YES"<<endl;
    return 0;
}

  

相關文章