younik要挂号

分析:
先从每个数中选n-1个不同的数(共C(n-1,m)种选法),
选出来的n-1个数中最大的那个数一定是序列的峰值,
再从那n-2个数中选出那个要重复一次的数(共C(n-2,1)种选法),
余下的n-3个数中的每个数要么在峰值左侧要么在右侧(共2^(n-3)种选法) 。
因此有:C(n-1,m)*C(1,n-2)*2^(n-3)。

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+10;
const ll mod=998244353; 
int n,m;
ll f[N],sum=0;
ll qpow(ll a,ll b){
	ll res=1;
	while(b){
		if(b&1) res=res*a%mod;
		a=a*a%mod;
		b=b>>1;
	}
	return res;
}
void Init(){
	f[0]=1;
	for(int i=1;i<N;i++) f[i]=f[i-1]*(ll)i%mod;
}
int main(){
	/* 先从每个数中选n-1个不同的数(共C(n-1,m)种选法), 选出来的n-1个数中最大的那个数一定是序列的峰值, 再从那n-2个数中选出那个要重复一次的数(共C(n-2,1)种选法) 余下的n-3个数中的每个数要么在峰值左侧要么在右侧(共2^(n-3)种选法) 因此有:C(n-1,m)*C(1,n-2)*2^(n-3) */
	
	Init();
   scanf("%d %d",&n,&m);
    if(n==2) printf("0\n");
    else{
        ll sum=(n-2)*qpow(2,n-3)%mod*f[m]%mod*qpow(f[m-n+1]*f[n-1]%mod,mod-2)%mod;//C(n-1,m)*C(1,n-2)*2^(n-3)
   	
	printf("%lld\n",sum);
    }
   
	
	
	
	return 0;
}