求助大佬啊!70分 不知道哪里出问题了,蓝瘦,请dalao指点!

P1579 哥德巴赫猜想(升级版)

初心始现 @ 2019-07-22 15:11:12

include<iostream>

include<cmath>

using namespace std; int n,a=2,b=2; bool p(int n){
for(int i=2;i<=int(sqrt(n));i++) if(n%i==0) return 0; return 1;} int main() {cin>>n; for (int i=1;i<=n;i++){a++; for(int j=1;i<=n/2;i++){b++; if(p(a)+p(b)+p(n-a-b)==3){cout<<a<<" "<<b<<" "<<n-a-b;break;}
} }return 0; }


by 初心始现 @ 2019-07-22 15:14:36

include<iostream>

include<cmath>

using namespace std;

int n,a=2,b=2;
bool p(int n){
for(int i=2;i<=int(sqrt(n));i++)
        if(n%i==0)  return 0;
        return 1;}

int main() {cin>>n;

for (int i=1;i<=n;i++){

a++;
for(int j=1;i<=n/2;i++){b++;
if(p(a)+p(b)+p(n-a-b)==3)            {cout<<a<<" "<<b<<" "<<n-a-b;break;}       

} }return 0; }


by Lstdo @ 2019-07-22 15:18:33

希丰展?使MD


by 铃宕 @ 2019-07-22 15:21:41

希丰展?使MD


by SSerxhs @ 2019-07-22 15:25:35

希丰展?使MD


by Methylene_Blue @ 2019-07-22 15:36:10

希丰展?使MD


by 初心始现 @ 2019-07-22 18:16:34

黑人:????????


by 初心始现 @ 2019-07-22 18:16:47

什么东东


by 初心始现 @ 2019-07-22 18:24:10

希望更丰富的展现?使用Markdown

但是我确实不会用......


by 初心始现 @ 2019-07-24 21:56:24

include<iostream>

include<cmath>

using namespace std; int n,a=2,b=2; bool p(int n){
for(int i=2;i<=int(sqrt(n));i++)               if(n%i==0) return 0;                       return 1;} 
                                int main() {cin>>n; 
  for (int i=1;i<=n;i++){a++;                for(int j=1;i<=n/2;i++){b++; if(p(a)+p(b)+p(n-a-b)==3){cout<<a<<" "<<b<<" "<<n-a-b;break;}
} }return 0; }

by 初心始现 @ 2019-07-24 21:56:48

include<iostream>

include<cmath>

using namespace std; int n,a=2,b=2; bool p(int n){
for(int i=2;i<=int(sqrt(n));i++) if(n%i==0) return 0; return 1;} int main() {cin>>n; for (int i=1;i<=n;i++){a++; for(int j=1;i<=n/2;i++){b++; if(p(a)+p(b)+p(n-a-b)==3){cout<<a<<" "<<b<<" "<<n-a-b;break;}
} }return 0; }

| 下一页