题解 | 素数判断

素数判断

https://www.nowcoder.com/practice/5ab1b9690af047699e96c87dee65def4

t=int(input())
i=0
while i<t:
    n=int(input())
    if n<2:
        print("No")
    else:
        m=1
        j=2
        while j*j<=n:
            if n%j==0:
                m=0
                break
            j+=1
        if m==1:
            print("Yes")        
        else:
            print("No")
    i+=1        

全部评论

相关推荐

双尔:你就写拥有ai开发经历,熟练运用提示词,优化ai,提高ai回答质量
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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