记录详情

Time Exceeded


  
# 状态 耗时 内存占用
#1 Accepted 3ms 2.25 MiB
#2 Accepted 3ms 2.375 MiB
#3 Accepted 3ms 2.203 MiB
#4 Accepted 3ms 2.25 MiB
#5 Accepted 4ms 2.25 MiB
#6 Time Exceeded ≥1006ms ≥117.0 MiB
#7 Accepted 978ms 97.625 MiB
#8 Time Exceeded ≥1003ms ≥116.875 MiB
#9 Time Exceeded ≥1007ms ≥116.109 MiB
#10 Accepted 886ms 85.176 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;
		}
	}
}
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);
		For(i,1,t)	ans=(ans*num)%mo;
	}
	printf("%lld\n",ans);
}

信息

递交者
类型
递交
题目
篝题
语言
C++
递交时间
2017-05-02 10:41:35
评测时间
2017-05-02 10:41:35
评测机
分数
70
总耗时
≥4901ms
峰值内存
≥117.0 MiB