-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1036.cpp
62 lines (62 loc) · 1.08 KB
/
1036.cpp
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include"iomanip"
#include"iostream"
#include"limits"
#include"cmath"
#include"vector"
#include"algorithm"
#include"list"
#include"queue"
#include"stack"
#include"set"
#include"unordered_set"
#include"map"
#include"unordered_map"
#include"string"
#include"cstring"
#include"assert.h"
using namespace std;
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define mp make_pair
#define pb push_back
#define mset(a,b) memset(a,b,sizeof(a))
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll dp[55][1005];
ll solve(int n,int s)
{
if(dp[n][s]!=-1)return dp[n][s];
if(n==1)
{
if(s>=0&&s<=9)
{
return dp[n][s]=1;
}
else return dp[n][s]=0;
}
ll ans=0;
for(int i=0;i<10;++i)
{
ans+=solve(n-1,s-i);
}
return dp[n][s]=ans;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,s;
cin>>n>>s;
if(s%2!=0)
{
cout<<"0\n";
return 0;
}
s/=2;
mset(dp,-1);
ll ans=solve(n,s);
cout<<ans*ans<<'\n';
}