Metal Steak

Hard to eat

  C++博客 :: 首页 :: 联系 :: 聚合  :: 管理
  0 Posts :: 79 Stories :: 0 Comments :: 0 Trackbacks

公告

aaaaaaaaaaaa

常用链接

留言簿(1)

我参与的团队

搜索

  •  

最新评论

#include <iostream>
using namespace std;

int main()
{
    
bool primef(int);
    
int n;
    cin
>>n;
    
for(int i=2;i<=n/2;i++)
        
if(primef(i))
            
if(primef(n-i))
                {
                    cout
<<i<<"+"<<(n-i)<<endl;
                    
break;
                }

    
return 0;
}

bool primef(int n)
{
     
bool prime=true;
     
for(int i=2;i*i<=n;i++)
     {
         prime
=true;
         
if(n%i==0||i*i==n)
         {
             prime
=false;
             
break;
         }
     }
     
if(prime) return true;
     
else return false;
}

posted on 2009-09-15 21:51 mad4alcohol 阅读(118) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。
网站导航:   博客园   博客园最新博文   博问   管理