/ Randle /

记录详情

Accepted

/in/foo.cc:21:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
/in/foo.cc: In function 'int main()':
/in/foo.cc:23:7: warning: unused variable 'j' [-Wunused-variable]
  ll i,j,x;
       ^
# 状态 耗时 内存占用
#1 Accepted 2ms 256.0 KiB
#2 Accepted 3ms 372.0 KiB
#3 Accepted 2ms 328.0 KiB
#4 Accepted 3ms 328.0 KiB
#5 Accepted 3ms 348.0 KiB
#6 Accepted 5ms 352.0 KiB
#7 Accepted 8ms 268.0 KiB
#8 Accepted 12ms 384.0 KiB
#9 Accepted 16ms 376.0 KiB
#10 Accepted 19ms 364.0 KiB

代码

#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
const ll base=1000000007;
ll m,n,ans=0;

ll f(ll a,ll b)
{
	int res=1;
	while(b)
	{
		if(b%2==1)
			res=res*a%base;
		b/=2;
		a=a*a%base;
	}
	return res;
}
main()
{
	ll i,j,x;
	cin>>n>>m;
	ans=m;
	for(i=2;i<=n;i++)
	{
		x=i*(f(i,m)-1+base)%base;
		ans=(ans+x*f(i-1,base-2))%base;
	}
	cout<<ans%base;
}

信息

递交者
类型
递交
题目
和 T1
题目数据
下载
语言
C++
递交时间
2017-09-09 16:11:44
评测时间
2017-09-09 16:11:44
评测机
分数
10
总耗时
77ms
峰值内存
384.0 KiB