答案
2024-02-15 15:00:37
发布于:浙江
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,x[21] = {0},c = 0,i = 0,a[21] = {0};
cin>>n;
while(c<=20){
i++;
int num[5] = {0};
int tmp = i;
int sum = 0,ans = 0;
while(tmp>0){
num[sum] = tmp%10;
tmp/=10;
sum++;
}
for(int i = 0;i<sum;i++){
ans+=pow(num[i],sum);
}
if(i == ans){
x[c++] = i;
}
}
for(int i = 0;i<n;i++){
int q;
cin>>q;
cout<<x[q-1]<<endl;
}
return 0;
}
全部评论 1
好好好这么玩
2024-02-15 来自 浙江
0
有帮助,赞一个