UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#203999#170. 数数gispzjz10082ms8336kbC++11787b2024-03-31 13:47:222024-03-31 13:47:24

answer

#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#define L long long
using namespace std;
int n,m,f[55][55][2610],p,q=998244353;
inline void add(int &a,long long b)
{
	a=(a+b)%q;
}
int main()
{
	int i,j,k;
	scanf("%d%d",&n,&m);
	f[0][0][0]=1;
	for(i=1;i<=n;i++)
	  for(j=0;j<i;j++)
	    for(k=0;k<=2500;k++)
	      if(f[i-1][j][k])
	        {
			 add(f[i][j+1][k+i],f[i-1][j][k]);
			 add(f[i][j+2][k+2*i],(L)f[i-1][j][k]*(i-1-j)*(i-1-j));
			 add(f[i][j+1][k+i],(L)f[i-1][j][k]*(i-1-j));
			 add(f[i][j+1][k+i],(L)f[i-1][j][k]*(i-1-j));
			 add(f[i][j][k],f[i-1][j][k]);
			}
	for(i=m;i<=2500;i++)
	  p=(p+f[n][n][i])%q;
	for(i=1;i<=n;i++)
	  p=(L)p*i%q;
	printf("%d\n",p);
	return 0;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 1ms
memory: 1324kb

input:

6 25

output:

468000

result:

ok single line: '468000'

Test #2:

score: 10
Accepted
time: 0ms
memory: 1448kb

input:

9 55

output:

94864779

result:

ok single line: '94864779'

Test #3:

score: 10
Accepted
time: 0ms
memory: 1492kb

input:

10 70

output:

451961658

result:

ok single line: '451961658'

Test #4:

score: 10
Accepted
time: 0ms
memory: 2144kb

input:

19 188

output:

199080822

result:

ok single line: '199080822'

Test #5:

score: 10
Accepted
time: 0ms
memory: 2248kb

input:

20 233

output:

354115829

result:

ok single line: '354115829'

Test #6:

score: 10
Accepted
time: 0ms
memory: 2052kb

input:

18 200

output:

360483048

result:

ok single line: '360483048'

Test #7:

score: 10
Accepted
time: 11ms
memory: 7064kb

input:

46 1200

output:

744054009

result:

ok single line: '744054009'

Test #8:

score: 10
Accepted
time: 22ms
memory: 7680kb

input:

48 1333

output:

506724228

result:

ok single line: '506724228'

Test #9:

score: 10
Accepted
time: 25ms
memory: 8336kb

input:

50 1275

output:

263941435

result:

ok single line: '263941435'

Test #10:

score: 10
Accepted
time: 23ms
memory: 8336kb

input:

50 1800

output:

763816424

result:

ok single line: '763816424'