为啥RE了?
  • 板块学术版
  • 楼主Lemon_zqp
  • 当前回复3
  • 已保存回复3
  • 发布时间2023/12/3 19:10
  • 上次更新2023/12/3 21:20:02
查看原帖
为啥RE了?
551630
Lemon_zqp楼主2023/12/3 19:10
#include<bits/stdc++.h>
#define int long long
using namespace std;

bool used[1000005], vis[1000005];
int cnt[1000005];

long long poww(int a, int b){
	long long ans = 1;
	for(int i = 1; i <= b; i++){
		ans *= a;
	}
	return ans;
} 

signed main(){
	int sum = 0, ans = 1;
	int n, m;
	cin >> n >> m;
	for(int i = 1; i <= 20; i++){
		for(int j = 1; j <= m; j++){
			if(used[i * j] == false){
				sum++;
				used[i * j] = true;
			}
		}
		cnt[i] = sum;
	}
	for(int i = 2; i <= n; i++){
		int cntt = 0;
		if(vis[i] == false){
			for(int j = 1; poww(i, j) <= n; j++){
				cntt++;
				vis[poww(i, j)] = true;
			}
			ans += cnt[cntt];
		}
	}
	cout << ans;
    return 0;
}

2023/12/3 19:10
加载中...