SHARE
TWEET

Untitled

a guest Dec 8th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     string a;
  8.     cin >> a;
  9.     vector<long long> numbers(a.length(), 0);
  10.     numbers.back() = 1;
  11.     numbers.emplace_back(1);
  12.  
  13.     for (int i = static_cast<int>(a.length()) - 2; i >= 0; --i) {
  14.         if ((a[i] > '0' && a[i] < '3') || (a[i] == '3' && a[i + 1] < '4')) {
  15.             numbers[i] = numbers[i + 2];
  16.         }
  17.         numbers[i] += numbers[i + 1];
  18.     }
  19.     cout << numbers[0];
  20. }
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