记录详情

Time Exceeded


  
# 状态 耗时 内存占用
#1 Accepted 3ms 2.25 MiB
#2 Accepted 3ms 2.25 MiB
#3 Accepted 3ms 2.25 MiB
#4 Accepted 3ms 2.34 MiB
#5 Accepted 4ms 2.25 MiB
#6 Time Exceeded ≥1003ms ≥117.5 MiB
#7 Time Exceeded ≥1000ms ≥96.875 MiB
#8 Time Exceeded ≥1004ms ≥118.0 MiB
#9 Time Exceeded ≥1001ms ≥116.125 MiB
#10 Accepted 880ms 84.469 MiB

代码

#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<queue>
#include<string>
#include<map>
#include<cstring>
#include<vector>
#define inf 1e9
#define ll long long
#define For(i,j,k) for(ll i=j;i<=k;i++)
#define Dow(i,j,k) for(ll i=k;i>=j;i--)
using namespace std;
ll mo=1000000007;
ll n,tot,pri[10000001],ans;
bool bj[100000001];
void get_pri()
{
	For(i,2,n)
	{
		if(!bj[i])	
			pri[++tot]=i;
		For(j,1,tot)
		{
			if(i*pri[j]>n)	break;
			bj[i*pri[j]]=1;
			if(i%pri[j]==0)	break;
		}
	}
}
ll ksm(ll x,ll y)
{
	ll sum=1;for(;y;y>>=1){if(y&1)sum=sum*x;x=x*x;}	return sum;
}
int main()
{
	scanf("%lld",&n);
	get_pri();
	ans=1;
	For(i,1,tot)
	{
		ll num=pri[i];
	//	cout<<num<<endl;
		ll t=log(n)/log(num);
		ans=(ans*ksm(num,t))%mo;
	//	cout<<num<<' '<<t<<' '<<ksm(num,t)<<endl;
	}
	printf("%lld\n",ans);
}

信息

递交者
类型
递交
题目
篝题
语言
C++
递交时间
2017-05-02 10:45:57
评测时间
2017-05-02 10:45:57
评测机
分数
60
总耗时
≥4908ms
峰值内存
≥118.0 MiB