Fancy Mouse
- -|||
没错,看懂题目即可
#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;
}
posted on 2005-10-05 02:17  Fancy Mouse  阅读(299)  评论(1编辑  收藏  举报