记录详情

Time Exceeded


  
# 状态 耗时 内存占用
#1 Accepted 874ms 117.625 MiB
#2 Accepted 837ms 117.625 MiB
#3 Accepted 852ms 118.332 MiB
#4 Accepted 844ms 117.664 MiB
#5 Accepted 844ms 117.836 MiB
#6 Time Exceeded ≥1002ms ≥117.625 MiB
#7 Time Exceeded ≥1001ms ≥117.609 MiB
#8 Time Exceeded ≥1007ms ≥118.086 MiB
#9 Accepted 954ms 118.0 MiB
#10 Accepted 854ms 117.582 MiB

代码

#include<iostream>
#include<cstdio>
#include<cmath>
#define Ll long long
using namespace std;
const int M=1e8;
int q[6000000],tot;
bool com[M+5];
void findcom(){
    com[1]=1;
    for(int i=2;i<=M;i++){
        if(!com[i]){q[++tot]=i;}
        for(int j=1;j<=tot;j++){
            if(i*q[j]>M)break;
            com[i*q[j]]=1;
            if(i%q[j]==0)break;
        }
    }
}

int n,mo=1000000007,x;
Ll ans;
int main(){
    findcom();
    scanf("%d",&n);
    ans=1;
    for(int i=1;i<=tot;i++){
    	x=q[i];
    	if(x>n)break;
    	int y=log(n)/log(x);
    	while(y--)ans=(ans*x)%mo;
    }
    printf("%lld",ans);
}

信息

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