Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- #include <vector>
- #include <algorithm>
- #include <stack>
- #include <list>
- #include <cstring>
- #include <string>
- #include <string.h>
- using namespace std;
- long long stepen(int a, int b)
- {
- long long q=1;
- for (int i=0; i<b; i++)
- {
- q*=a;
- }
- return q;
- }
- long long faktoriel(int a, vector<int> x)
- {
- sort(x.rbegin(), x.rend());
- long long q=1;
- int k=1;
- for (int i=a; i>x[0]; i--)
- {
- q*=i;
- if (k<4 && q%x[k]==0)
- {
- q/=x[k];
- k++;
- }
- q%=1000000007;
- }
- return q;
- }
- int main()
- {
- vector<long long> count;
- string s;
- cin >> s;
- if (s[s.size()-1]!='0')
- {
- count.push_back(1);
- }
- else
- {
- count.push_back(0);
- }
- if (s[s.size()-2]=='0')
- {
- count.push_back(0);
- }
- else if (s.size()>1 && s[s.size()-1]!='0' && ((s[s.size()-2]=='1' || (s[s.size()-2]=='2' && s[s.size()-1]<'7'))))
- {
- count.push_back(2);
- }
- else
- {
- count.push_back(1);
- }
- for (int i=s.size()-3; i>=0; i--)
- {
- if (s[i]=='0')
- {
- count.push_back(0);
- }
- else if (s[i]=='1' || (s[i]=='2' && s[i+1]<'7'))
- {
- if (s[i+1]!='0')
- {
- count.push_back(count[count.size()-2]+count[count.size()-1]);
- }
- else
- {
- count.push_back(count[count.size()-2]);
- }
- }
- else
- {
- count.push_back(count[count.size()-1]);
- }
- }
- cout << count[count.size()-1];
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement