Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- const int N = 100010;
- char str[N];
- int dp[N];
- int main()
- {
- scanf("%s", str+1);
- int n = strlen(str+1);
- dp[0] = 1;
- dp[1] = str[1] != '0' ? 1 : 0;
- for (int i = 2; i <= n; ++i) {
- if (str[i] != '0')
- dp[i] += dp[i-1];
- int v = (str[i-1]-'0')*10 + (str[i]-'0');
- if (v >= 10 && v <= 26)
- dp[i] += dp[i-2];
- dp[i] %= 85142019;
- }
- printf("%d\n", dp[n]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement