水仙花数
2023-08-21 18:16:42
发布于:广东
0阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a,b,c;
    cin >> n;
    for (int x=100;x<=n;x++)
    {
    	a=x/100;
    	b=x/10%10;
    	c=x%10;
        if (a*a*a+b*b*b+c*c*c==x)
            cout << x << endl;
    }
    
}
这里空空如也





有帮助,赞一个