算法入门经典P52-例3-5(类似水仙花数)
作者:互联网
#include<iostream> using namespace std; int data[100005]; int main(){ int j,a[5],temp; for(int i=1;i<=100000;i++){ j = i; temp = i; while(j>0){ temp += j%10; j /= 10; } if(data[temp]==0){ data[temp] = i; } } while(scanf("%d",&temp)==1){ printf("%d\n",data[temp]); } return 0; }
标签:10,入门,temp,int,printf,j%,data,水仙花,P52 来源: https://www.cnblogs.com/stevenzrx/p/15503411.html