P1304 哥德巴赫猜想 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn)
#include
using namespace std;
struct student
{
string name;
int c,m,e,s;
};
bool check(int n)
{
for(int i=2;i*i<=n;i++)
{
if(n%i==0)return 0;
}
return 1;
}
void out(int n)
{
for(int i=2;i<=n;i++)
{
if(check(i)&&check(n-i))
{
cout< break; } } } int main() { int n;cin>>n;int cnt=0; for(int i=4;i<=n;i+=2) { out(i); } return 0; } 推荐链接
发表评论