跳到正文

题解

P11075 题解

ikunTLE约 1 分钟
原文
文章信息与版本

文章信息

发布
2024年9月17日
收录
2025年12月12日
更新
2026年11月11日
篇幅
约 1 分钟
获赞
12
题目
P11075

版本

  1. v1当前

题目传送门

思路

每一个排列方式 pp 仅有唯一对应的字符串 ss,故答案为 ∏i=1n+1i\prod\limits_{i=1}^{n+1}i,即 (n+1)!(n+1)!。

AC CODE

C++
#include<bits/stdc++.h>
using namespace std;
int read(){int x=0;char f=1,ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();return x*f;}

int main(){
	int n=read();
	long long ans=1;
	for(int i=1;i<=n+1;++i)
		ans=ans*i%998244353;
	cout<<ans;
	return 0;
}
原文
存档评论1 条抓取于