Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <vector>
- #include <string>
- const long long LIMIT = 1000000000000LL;
- const int WIDTH = 12;
- struct Int {
- long long a, b;
- Int(long long a = 0, long long b = 0) : a(a), b(b) { }
- inline Int operator + (const Int & other) {
- return Int(a+other.a+(b+other.b) / LIMIT, (b+other.b) % LIMIT);
- }
- };
- std::ostream & operator << (std::ostream & os, const Int & num) {
- if (num.a)
- os << num.a << std::setw(WIDTH) << std::setfill('0');
- return os << num.b;
- }
- inline bool is_digit(char a, char b) {
- return (a-'0') && (a-'0')*10+(b-'0') <= 33;
- }
- int main() {
- freopen("input.txt", "rt", stdin);
- freopen("output.txt", "wt", stdout);
- std::string s;
- std::cin >> s;
- int len = (int) s.length();
- std::vector<Int> count(1+len, Int(0, 1));
- for (int i = 2; i <= len; ++i)
- count[i] = is_digit(s[i-2], s[i-1]) ? count[i-2]+count[i-1] : count[i-1];
- std::cout << count.back();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement