文章

3

粉丝

0

获赞

13

访问

402

头像
素数判定 题解:
P1102 兰州大学机试题
发布于2026年3月16日 20:40
阅读数 53

#include <stdio.h>
#include <stdbool.h>
void sort(int *a,int *b){
    if(*a > *b){
        int temp=*a;
        *a=*b;
        *b=temp;
    }
}

bool Is_sushu(int n){
    //2 is sushu
    if(n == 2) return true;
    //n is sushu
    for(int i=2;i<n;i++)
        if(n%i == 0) return false;
    //n is not sushu
    return true;
}
int main(){
    int a;
    int b;
    while(scanf("%d%d",&a,&b) != EOF){
        sort(&a,&b);
        int flag=0;
        int count=0;
        while(a <= b){
      ...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发