| 比赛 |
26暑假集训模拟赛3 |
评测结果 |
RRRRRRRRRRRRRRRRRRRRRRRRR |
| 题目名称 |
Moo Decomposition |
最终得分 |
0 |
| 用户昵称 |
Lixj |
运行时间 |
0.069 s |
| 代码语言 |
C++ |
内存使用 |
3.74 MiB |
| 提交时间 |
2026-07-06 12:59:47 |
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int k,n,l,tot;
char T[100001];
const int mod=1e9+7;
long long c[10000001]={1},ans=1;
ll quick_power(ll a,ll b){
ll ans=1;
while(b){
if(b&1)
ans=1ll*ans*a%mod;
a=1ll*a*a%mod;
b>>=1;
}
return ans;
}
/*int zhs(int a,int b){
int jzh=c[b]*quick_power(c[b-a],mod-2)%mod;
return jzh*quick_power(c[a],mod-2)%mod;
}*/
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
//freopen("Moo.in","r",stdin);
//freopen("Moo.out","w",stdout);
cin>>k>>n>>l;
int jie=1;
for(int i=1;i<=k;i++){
jie=1ll*i*jie%mod;
}
string s;
cin>>s;
int O_number=0,res=1;
for(int i=0;i<s.size();i++){
if(s[i]=='M')
O_number+=k,tot++;
else{
res=1ll*res*O_number%mod;
O_number--;
}
}
/*for(int i=1;i<=k;i++)
c[i]=c[i-1]*i%mod;
for(int i=n-1;i>=0;i--){
if(T[i]=='M')
ans=ans*(zhs(k,tot-(n-i-tot)*k))%mod;
else
tot++;
}*/
cout<<quick_power(1ll*res*quick_power(quick_power(jie,tot),mod-2)%mod,l);
return 0;
}