样例过了,38pts求调
查看原帖
样例过了,38pts求调
1052511
XinFengIneverleft楼主2023/8/24 10:17
#include <bits/stdc++.h>
using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	long long l, r, w;
	cin >> l >> r >> w;
	long long i = 0;
	bool a = false;
	while (pow(w, i) <= r) {
		if (pow(w, i) >= l && pow(w, i) <= r) {
			cout << pow(w, i) << " ";
			a = true;
		}
		i++;
	}
	if (a == false)
		cout << -1;
	return 0;
}

2023/8/24 10:17
加载中...