题解 | #变种水仙花#

变种水仙花

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

#include <stdio.h>
#include <math.h>
int main() {
    int res = 0;
    for (int i = 10000; i <= 99999; i++) {
        for (int j = 1; j <= 4; j++) {
            res += (i / (int)pow(10, j)) * (i % (int)pow(10, j));
        }
        if (res == i) {
            printf("%d ", res);
        }
        res = 0;
    }

    return 0;
}
全部评论

相关推荐

EEbond:给北邮✌️跪了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务