比赛 |
2025.4.12 |
评测结果 |
AAAAAAAAAAAAAAAAAAAAAAAAA |
题目名称 |
Moo Decomposition |
最终得分 |
100 |
用户昵称 |
健康铀 |
运行时间 |
0.808 s |
代码语言 |
C++ |
内存使用 |
4.56 MiB |
提交时间 |
2025-04-12 11:14:45 |
显示代码纯文本
#include <iostream>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll p(ll x,ll y){
return y?(p(x*x%mod,y/2)*(y&1?x:1))%mod:1;
}
int main(){
freopen("Moo.in","r",stdin);
freopen("Moo.out","w",stdout);
ll k,n,l,f=1,a=1,o=0; string s;
cin>>k>>n>>l>>s; s=" "+s;
for(int i=1;i<=k;f=f*i++%mod);
f=p(f,mod-2);
for(int i=n;i;--i)
if(s[i]=='O') o++;
else{
ll c=1;
for(ll j=o-k+1;j<=o;c=c*j++%mod);
a=a*c%mod*f%mod;
o-=k;
}
cout<<p(a,l);
}