题解 | #兔子的序列#

兔子的序列

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

#include<stdio.h>//感觉写的有点复杂,就为了写个函数。。凑合着看吧。。。
int num(int x)
{
    int a=0;
    for(int i=1;i<33;i++)
    {
        if(x==i*i)
            a++;
    }
    if(a==0) return 1;
    else     return 0;
}
int main()
{
    int n,x,max=0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&x);
        int b= num(x);
        if(b)
        {
            if(x>max) max=x;
        }
    }
    printf("%d",max);
    return 0;
    
}

全部评论

相关推荐

不愿透露姓名的神秘牛友
06-04 15:20
牛客61197583...:看到室友一个个没怎么学通过关系直接入职或者接到面试,真的很难受。八股不知道背了多少遍,hot100也刷了1.5遍了,但就是没有面试的机会,唉
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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