ACon#1,#3,#6 题目大意为从小到大输出[l,r]范围内能表示成k的非负整数次方的数,特殊规定00=1。
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll t,l,r,k;
int main(){
// freopen("output.in","r",stdin);
// freopen("output.out","w",stdout);
cin>>t;
while(t--){
bool fl=0;
cin>>l>>r>>k;
if (k==0){
if (l<=1 && 1<=r){
cout<<1<<" ";
fl=1;
}if (l<=0 && 0<=r){
cout<<0<<" ";
fl=1;
}
if (!fl) cout<<"None.";
}else if (k==1){
if (l<=1 && 1<=r){
cout<<1<<" ";
fl=1;
}
if (!fl) cout<<"None.";
}else{
__int128 x=1;
while(x<=r){
if (x>=l){
ll now=x;
cout<<now<<" ";
fl=1;
}
x*=k;
}
if (!fl) cout<<"None.";
}
puts(" ");
}
return 0;
}