/ Randle /

记录详情

Wrong Answer


  
# 状态 耗时 内存占用
#1 Accepted 2ms 348.0 KiB
#2 Wrong Answer 2ms 256.0 KiB
#3 Wrong Answer 2ms 284.0 KiB
#4 Wrong Answer 3ms 352.0 KiB
#5 Wrong Answer 2ms 384.0 KiB
#6 Wrong Answer 2ms 256.0 KiB
#7 Wrong Answer 2ms 364.0 KiB
#8 Wrong Answer 6ms 376.0 KiB
#9 Wrong Answer 12ms 344.0 KiB
#10 Wrong Answer 12ms 344.0 KiB

代码

#include<bits/stdc++.h>
const long long maxn=50001,mod=1e9+7;
inline const void read(long long &a)
{
	a=0;
	char c=getchar();
	while(c<'0'||c>'9')c=getchar();
	while(c>='0'&&c<='9')
	{
		a=(a<<1)+(a<<3)+c-'0';
		c=getchar();
	}
}
inline const void write(long long a)
{
	if(a>=10)write(a/10);
	putchar(a%10+'0');
}
long long n,m,a[maxn],ans=0,sum;
inline long long fast_pow(long long x,long long y)
{
	long long base=x,k=y,res=1;
	while(k)
	{
		if(k&1)res=(res*base)%mod;
		k>>=1;
		base=(base*base)%mod;
	}
	return res;
}
int main()
{
	read(n);read(m);
	ans=(ans+m)%mod;
	for(long long i=2;i<=n;i++)
	{
		long long c=fast_pow(i,m);
		ans=(ans+i*(c-1)/(i-1))%mod;
	}
	write(ans);
	return 0;
}

信息

递交者
类型
递交
题目
和 T1
题目数据
下载
语言
C++
递交时间
2017-09-09 14:54:50
评测时间
2017-09-09 14:54:50
评测机
分数
1
总耗时
52ms
峰值内存
384.0 KiB