记录编号 607736 评测结果 AAAAAAAAAA
题目名称 3720.01数列 最终得分 100
用户昵称 Gravatar会挽弯弓满月 是否通过 通过
代码语言 C++ 运行时间 0.031 s
提交时间 2025-10-19 21:07:39 内存使用 3.86 MiB
显示代码纯文本
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll N=1010,mod=1e9+7;
ll n;
ll cnt1,cnt0;
ll ksm(ll x,ll y){
	if(y<0) return ksm(ksm(x,-y),mod-2);
	ll res=1;
	while(y){
		if(y&1) res=(res*x)%mod;
		x=(x*x)%mod;
		y>>=1;
	}
	return res;
}
ll ans;
int main(){
	freopen("01.in","r",stdin);
	freopen("01.out","w",stdout);
	scanf("%lld",&n);
	ll t,k;
	for(int i=1;i<=n;i++){
		scanf("%lld",&t);
		if(t==1) cnt1++;
		else cnt0++;
	}
	ans=ksm(2,n*cnt1)*ksm((1+ksm(2,2*cnt0-n)),n)%mod;
	printf("%lld",ans);
	return 0;
}