Q:找出3位数的所有水仙花树

 

#include <iostream>
using namespace std;

int main() {
	for(int a=1;a<=9;a++)
	for(int b=0;b<=9;b++)
	for(int c=0;c<=9;c++)
		if(a*100+b*10+c==a*a*a+b*b*b+c*c*c) {
			cout<<a*100+b*10+c<<endl;
		}
	
	return 0;
}

  

posted on 2017-04-28 18:09  王小东大将军  阅读(175)  评论(0编辑  收藏  举报