C/C++题解:
具体思路:先用质数筛法找到1000以内的全部质数,然后逐一处理即可
#includeusing namespace std;int q;long long n,k,ans;vector Sushu;void is_prime(){ bool isPrime[1001];for(int i=2;i<=1000;i++){isPrime[i]=true;} for(int i=2;i*i<=1000;i++){if(isPrime[i]){for(int j=i*i;j<=1000;j+=i){isPrime[j]=false;}}}for(int i =2;i> q;while(q--){cin >> n >> k;ans = 1;int flag = 0,curK = 0;while(n>1&&flag<Sushu.size()){if(n%Sushu[flag] == 0){curK ++;n /= Sushu[flag];}else{if(curK<k){curK = 0;flag++;continue;}for(int i = 0;i= k){for(int i = 0;i<curK;i++){ans*=Sushu[flag];}}cout << ans << endl;}}
···