记录详情

Accepted


  
# 状态 耗时 内存占用
#1 Accepted 3ms 2.25 MiB
#2 Accepted 3ms 2.25 MiB
#3 Accepted 2ms 2.375 MiB
#4 Accepted 3ms 2.332 MiB
#5 Accepted 4ms 2.25 MiB
#6 Accepted 800ms 117.625 MiB
#7 Accepted 543ms 82.25 MiB
#8 Accepted 807ms 117.625 MiB
#9 Accepted 767ms 113.121 MiB
#10 Accepted 489ms 71.473 MiB

代码

#include<iostream>
#include<cstdio>
#include<cmath>
#define Ll long long
using namespace std;
const int M=1e8;
int q[5761456],tot;
bool com[M+5];
int n,mo=1000000007;
Ll ans,x;
void findcom(){
    com[1]=1;
    for(int i=2;i<=n;i++){
        if(!com[i]){q[++tot]=i;}
        for(int j=1;j<=tot;j++){
            if(i*q[j]>n)break;
            com[i*q[j]]=1;
            if(i%q[j]==0)break;
        }
    }
}
int main(){
    scanf("%d",&n);
    findcom();
    ans=1;
    for(int i=1;i<=tot;i++){
    	x=q[i];
    	if(x>n)break;
    	while(x*q[i]<=n)x*=q[i];
    	ans=ans*x;
    	if(ans>=mo)ans%=mo;
    }
    printf("%d",int(ans));
}

信息

递交者
类型
递交
题目
篝题
语言
C++
递交时间
2017-05-02 11:02:08
评测时间
2017-07-14 16:01:56
评测机
分数
100
总耗时
3427ms
峰值内存
117.625 MiB