文章

34

粉丝

261

获赞

10

访问

11.4k

头像
水仙花数 题解:C
fzh VIP
P1034 中南大学机试题
发布于2024年1月19日 14:34
阅读数 369

#include<stdio.h>
#include<math.h>

int Judge(int x)
{
    int temp = x;
    if ((int)pow(x / 100, 3) + (int)pow(x % 100 / 10, 3) + (int)pow(x % 10, 3) == temp)return 1;
    return 0;

}

int main()
{
    int m, n;
    scanf("%d %d", &m, &n);
    while (m != 0 || n != 0) {
        int result = 0;
        for (int i = m; i < n + 1; i++)
            if (Judge(i)) {
                result++;
                printf("%d ", i);
            };
    

    if (result == 0)printf("no\n");
    else printf("\n")...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发