全RE,求调
查看原帖
全RE,求调
1381680
soochoo楼主2024/11/27 20:33
#include<bits/stdc++.h>
using namespace std;
bool lucky[10000005];

int main(){
    int n,a,op;
    cin>>a>>n;
    for(int i=a;i<=10000001;i++){
        if(sqrt(i)*sqrt(i)==i&&lucky[i]==1){
            for(int j=1;i*j<=10000001;j++)lucky[i*j]=1;
        }    
    }
    while(n--){
        cin>>op;
        if(lucky[op])cout<<"lucky"<<endl;
        else{
            while(!lucky[op])op++;
            cout<<op<<endl;
        }
    }
}
2024/11/27 20:33
加载中...