题解 | #变种水仙花#

变种水仙花

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

#include <stdio.h>

int main() {

    for (unsigned int i = 10000; i <= 99999; i++)
    {
       int num = 0;

       for (int j = 10; j <= 10000; j *= 10)
       {
            num += (i / j) * (i % j);  
       }

       if (num == i)
       {
            printf("%d ", i);
       }
    }
    return 0;
}

全部评论

相关推荐

评论
点赞
收藏
分享
牛客网
牛客企业服务