记录详情

Accepted

/in/foo.cc: In function 'int main()':
/in/foo.cc:25:20: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
  printf("%d\n", ans);
                    ^
# 状态 耗时 内存占用
#1 Accepted 1ms 2.375 MiB
#2 Accepted 3ms 2.25 MiB
#3 Accepted 3ms 2.25 MiB
#4 Accepted 3ms 2.25 MiB
#5 Accepted 3ms 2.25 MiB
#6 Accepted 730ms 117.625 MiB
#7 Accepted 501ms 81.0 MiB
#8 Accepted 732ms 117.625 MiB
#9 Accepted 706ms 116.492 MiB
#10 Accepted 426ms 71.375 MiB

代码

#include <bits/stdc++.h>
#define N 100000020
#define mod 1000000007
using namespace std;
int n, pri[6000000], cnt;
bool mark[N];
long long x, ans = 1;
void getPri(int x){
	for(int i = 2; i <= x; i++){
		if(!mark[i])pri[++cnt]=i;
		for(int j = 1; j <= cnt && pri[j]*i <= x; j++){
			mark[pri[j]*i] = 1;
			if(i%pri[j]==0)break;
		}
	}
}
int main(){
	scanf("%d", &n);
	getPri(n);
	for(int i = 1; i <= cnt; i++){
		x = pri[i];
		while(x*pri[i] <= n) x*=pri[i];
		ans = ans*x%mod;
	}
	printf("%d\n", ans);
}

信息

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