题目在这,救救孩子吧qwq
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;
ull qpow(ull a,ull b){
ull ans=1,base=a;
while(b > 0){
if(b & 1){
ans *= base;
}
base *= base;
b >>= 1;
}
return ans;
}
int main(){
ull qwq,awa,w,tmp=0,cnt;
cin>>qwq>>awa>>w;
if(w==1 and qwq==1){
cout<<1;
return 0;
}
for(ull i=0;;i++){
if(i==0){
if(qpow(w,i)<=awa and qpow(w,i)>=qwq){
cout<<qpow(w,i)<<" ";
tmp++;
}else{
break;
}
}else{
if(qpow(w,i)<=awa and qpow(w,i)>=qwq and qpow(w,i)>=w){
cout<<qpow(w,i)<<" ";
tmp++;
}else{
break;
}
}
}
if(tmp==0){
cout<<-1;
}
}