-
Notifications
You must be signed in to change notification settings - Fork 0
坑爹的水仙花数
Zhang Chenghao edited this page Nov 20, 2018
·
1 revision
#include<stdio.h> pow(int a,int b){ int pro=1,i; for(i=b;i>0;i--) pro *= a; return pro; } main(){ int n,i,sum,temp,num; scanf("%d",&n); num=pow(10,n-1); for(i=num;i<10*num;i+){ temp=i; sum=0; while(temp>0){ sum=pow(temp%10,n); temp/=10; }
if(sum==i) printf("%d\n",i); } return 0; }