题解 | #输出水仙花数#

输出水仙花数

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

#include <iostream>
#include <cmath>
using namespace std;

int main() {
    
    // write your code here......
    for(int i = 100; i < 1000; ++i){
        if(i == pow(i / 100, 3) + pow(i % 10, 3) + pow((i / 10) % 10, 3))
            cout<<i<<endl;
    }
    

    return 0;
}

全部评论

相关推荐

SHC2:春招先狠狠投递,然后你看看能不能申请香港新加坡的一年制master,花不了多少钱,或者现在赶紧去刷一段实习。HR专业考研没必要
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
正在热议
更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务