记录详情

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 3ms 2.25 MiB
#2 Accepted 3ms 2.25 MiB
#3 Accepted 3ms 2.25 MiB
#4 Accepted 3ms 2.25 MiB
#5 Accepted 3ms 2.348 MiB
#6 Accepted 765ms 34.125 MiB
#7 Accepted 642ms 25.785 MiB
#8 Accepted 757ms 34.125 MiB
#9 Accepted 737ms 33.496 MiB
#10 Accepted 429ms 21.75 MiB

代码

#include <bits/stdc++.h>
#define N 100000020
#define mod 1000000007
using namespace std;
int n, pri[6000000], cnt;
bitset<N> mark;
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 11:14:43
评测时间
2017-06-23 14:59:25
评测机
分数
100
总耗时
3350ms
峰值内存
34.125 MiB