题解 | #兔子的序列#

兔子的序列

https://www.nowcoder.com/practice/55fc2ebad3fd444bbb1754ba1b259762

#include <stdio.h>

int main() {
    // 读取用户输入的整数的个数
    int count = 0;
    // 存储用户输入的数据
    int num = 0;

    while (1 == scanf("%d", &count))
    {
        int max = 0;
        
        for (int i = 0; i < count; i++)
        {
            int flag = 1;
            scanf("%d",&num);
            for (int mul = 1; mul < num; mul++)
            {
                if ((mul * mul) == num)
                {
                    flag = 0;
                    break;
                }
            }
            if (flag)
            {
                // 获取最大值
                max = max > num ? max : num;
            }
        }
        printf("%d\n", max);
    }

    return 0;
}

全部评论

相关推荐

不愿透露姓名的神秘牛友
昨天 12:10
点赞 评论 收藏
分享
06-17 21:57
门头沟学院 Java
白友:噗嗤,我发现有些人事就爱发这些,明明已读不回就行了,就是要恶心人
点赞 评论 收藏
分享
下北澤大天使:你是我见过最美的牛客女孩😍
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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