fix lq148jz bug

This commit is contained in:
Zengtudor 2024-08-24 17:20:59 +08:00
parent ba9ec63d10
commit f0ba77c0bb
1 changed files with 12 additions and 11 deletions

View File

@ -1,14 +1,14 @@
#include<bits/stdc++.h> #include<bits/stdc++.h>
using namespace std; using namespace std;
bool is_pf(int n){ // bool is_pf(int n){
int a = sqrt(n); // int a = sqrt(n);
if(a*a==n){ // if(a*a==n){
return true; // return true;
}else{ // }else{
return false; // return false;
} // }
} // }
bool is_huiwen(int n){ bool is_huiwen(int n){
stringstream ss; stringstream ss;
@ -29,9 +29,10 @@ int main(){
int n; int n;
cin>>n; cin>>n;
for(int i=1;i<=n;i++){ const int sqrt_n = sqrt(n);
if(is_pf(i)&&is_huiwen(i)){ for(int i=1;i<=sqrt_n;i++){
cout<<i<<" "; if(is_huiwen(i*i)){
cout<<i*i<<" ";
} }
} }
cout<<endl; cout<<endl;