Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- typedef long long ll;
- ll dp[100001][10];
- using namespace std;
- ll can(ll i,ll j){
- return (j<10&&j>0?dp[i][j]:0);
- }
- void pre_calc{
- for (int j=1;j<=9;j++){
- dp[1][j]=1;
- }
- for (int i=2;i<=100000;i++){
- for (int j=1;j<=9;j++){
- dp[i][j]=can(i,j+1)+can(i,j-1)+dp[i][j];
- }
- }
- }
- int main()
- {
- pre_calc;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement