SHARE
TWEET

codeforce - magic numbers

jakaria_hossain Apr 10th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     int i,len;
  6.     string s;
  7.     getline(cin,s);
  8.     len=s.size();
  9.     for(i=0;i<len;i++)
  10.     {
  11.         if(s[0]!='1')break;
  12.         if(s[i]=='1')continue;
  13.         if(s[i]=='4')
  14.         {
  15.             if(s[i+1]=='4' && s[i+2]=='4')break;
  16.         }
  17.         else break;
  18.     }
  19.     if(i<len)printf("NO\n");
  20.     else printf("YES\n");
  21.     return 0;
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top