题解 | #输出水仙花数#

输出水仙花数

https://www.nowcoder.com/practice/dabaf13009ef4d0cbf22302fd6a530a6

#include <iostream>
using namespace std;
#include<math.h>

int main() {
    
    for(int a=100;a>=100&&a<=999;a++)
    {
        if(pow(int(a/100),3)+pow(int(a/10)%10,3)+pow(int(a%10),3)==a)
cout<<a<<endl;
    }

    return 0;
}

全部评论

相关推荐

投递美团等公司9个岗位
点赞 评论 收藏
转发
点赞 收藏 评论
分享
牛客网
牛客企业服务