没错,看懂题目即可
#include<iostream>
#include<cmath>
using namespace std;
#define YES {cout<<"It's a MaoLaoDa number."<<endl;continue;}
#define NO {cout<<"It's not a MaoLaoDa number."<<endl;continue;}
int main()
{
long n,test,m;
int flag1,flag2,temp;
while(cin>>n)
{
flag1=1;flag2=0;m=(long)sqrt((double)n);
for(temp=2;temp<=m;temp++)
if(n % temp == 0)
{flag1=0;break;}
if(flag1)
NO
test=n/temp;
m = (long)sqrt((double)test);
for(temp=2;temp<=m;temp++)
if(test % temp == 0)
{;flag2=1;break;}
if(flag2)
NO
else
YES
}
return 0;
}
#include<cmath>
using namespace std;
#define YES {cout<<"It's a MaoLaoDa number."<<endl;continue;}
#define NO {cout<<"It's not a MaoLaoDa number."<<endl;continue;}
int main()
{
long n,test,m;
int flag1,flag2,temp;
while(cin>>n)
{
flag1=1;flag2=0;m=(long)sqrt((double)n);
for(temp=2;temp<=m;temp++)
if(n % temp == 0)
{flag1=0;break;}
if(flag1)
NO
test=n/temp;
m = (long)sqrt((double)test);
for(temp=2;temp<=m;temp++)
if(test % temp == 0)
{;flag2=1;break;}
if(flag2)
NO
else
YES
}
return 0;
}