P5104 红包发红包

期望

#include<cstdio>
#include<iostream>
using namespace std;
const int mod=1e9+7;
typedef long long ll;
ll w,n,k;
ll ksm(ll a,ll b){
	ll res=1;
	while(b){
		if(b&1) res=res*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return res%mod;
}
int main(){
	scanf("%lld%lld%lld",&w,&n,&k);
	printf("%lld",(w*ksm(ksm(2,k),mod-2))%mod);
	return 0;
}
posted @ 2021-11-18 20:47  dfydn  阅读(16)  评论(0编辑  收藏  举报