Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- typedef unsigned long long ull;
- typedef map <int, int> mii;
- typedef pair <int, int> pii;
- typedef pair <ll, ll> pll;
- int const maxn = int(1e5 + 12);
- int const maxb = int(2e6 + 12);
- int const inf = int(1e9 + 7);
- ll const linf = ll(1e18 + 12);
- double const eps = 1e-7;
- double const pi = acos(-1);
- #ifdef _WIN32
- #define I64 "%I64d"
- #else
- #define I64 "%lld"
- #endif
- #define mp make_pair
- #define pb push_back
- #define F first
- #define S second
- //#define fn ""
- ll dp[15][20];
- int n;
- ll rec(int len, int last)
- {
- if (len == n)
- return 1;
- ll & ans = dp[last][len];
- if (ans != -1)
- return ans;
- ans = 0;
- for (int i = 0; i < 10; i++)
- if (i != last)
- ans += rec(len + 1, i);
- return ans;
- }
- int main()
- {
- #ifdef fn
- freopen(fn".in", "r", stdin);
- freopen(fn".out", "w", stdout);
- #endif
- scanf("%d", &n);
- memset(dp, -1, sizeof(dp));
- printf(I64, rec(0, 0));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement