forked from daiwb/Algorithm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path164.cpp
More file actions
41 lines (33 loc) · 670 Bytes
/
164.cpp
File metadata and controls
41 lines (33 loc) · 670 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>
#include <sstream>
#include <algorithm>
#include <iterator>
#include <vector>
#include <deque>
#include <set>
#include <cmath>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
typedef long long LL;
LL mm[25][10][10];
LL dp(int left, int a, int b) {
LL& ret = mm[left][a][b];
if (ret != -1) return ret;
if (left == 0) return ret = 1;
ret = 0;
FOR(i,0,9-a-b) ret += dp(left - 1, b, i);
return ret;
}
void run() {
memset(mm, -1, sizeof(mm));
LL res = 0;
FOR(i,1,9) {
FOR(j,0,9-i) {
res += dp(18, i, j);
}
}
cout << res << endl;
}
int main() {
run();
}