文章

308

粉丝

0

获赞

122

访问

17.4k

头像
素数判定 - 哈尔滨工业大学 题解:
P1355 哈尔滨工业大学机试
发布于2026年1月25日 20:35
阅读数 109

#include<stdio.h>
#include<math.h>
using namespace std;
int fun(int x)
{
    for(int i=2;i<=sqrt(x);i++)
    {
        if(x%i==0)
        {
            return 0;
        }
    }
    return 1;
 } 
int main()
{
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        if(n<2)
        {
            printf("no\n");
            continue;
        }
        if(fun(n))
        {
            printf(&qu...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发