5 条题解
-
1
#include<iostream> using namespace std; bool check(int a) { if(a==1) return false; for(int i=2;i<a;i++) { if(a%i==0) return false; } return true; } int main() { for(int i=6;i<=100;i+=2) { for(int j=2;j<=i;j++) { if(check(j) && check(i-j)) { cout << i << "=" << j << "+" << i-j << endl; break; } } } return 0; }
-
1
好像也不难
#include<iostream> #include<cstdio> #include<cmath> using namespace std; bool isprime(int n1,int n2){ if(n1==1||n2==1) return false; for(int i=2;i<=sqrt(n1);i++) if(n1%i==0) return false; for(int i=2;i<=sqrt(n2);i++) if(n2%i==0) return false; return true; } void fuc(int n){ for(int i=1;i<=n;i++){ int j=n-i; if(isprime(j,i)){ printf("%d=%d+%d\n",n,min(i,j),max(i,j)); return; } } } int main(){ for(int i=6;i<=100;i+=2){ fuc(i); } }
-
1
#include <bits/stdc++.h> using namespace std; bool sushu(int a) { if (a==2) return true; if (a<=1 || a%2==0) return false; for (int i=3;i<a;i++){ if (a%i==0) return false; } return true; } int main() { for (int i=6;i<=100;i+=2){ for (int f=1;f<=i;f++){ if (sushu(f) && sushu(i-f)){ cout<<i<<"="<<f<<"+"<<i-f<<endl; break; } } } return 0; }//普通筛法
-
1
极致yasuo👀️
#include <iostream> int main(){std::cout << "6=3+3" << std::endl << "8=3+5" << std::endl << "10=3+7" << std::endl << "12=5+7" << std::endl << "14=3+11" << std::endl << "16=3+13" << std::endl << "18=5+13" << std::endl << "20=3+17" << std::endl << "22=3+19" << std::endl << "24=5+19" << std::endl << "26=3+23" << std::endl << "28=5+23" << std::endl << "30=7+23" << std::endl << "32=3+29" << std::endl << "34=3+31" << std::endl << "36=5+31" << std::endl << "38=7+31" << std::endl << "40=3+37" << std::endl << "42=5+37" << std::endl << "44=3+41" << std::endl << "46=3+43" << std::endl << "48=5+43" << std::endl << "50=3+47" << std::endl << "52=5+47" << std::endl << "54=7+47" << std::endl << "56=3+53" << std::endl << "58=5+53" << std::endl << "60=7+53" << std::endl << "62=3+59" << std::endl << "64=3+61" << std::endl << "66=5+61" << std::endl << "68=7+61" << std::endl << "70=3+67" << std::endl << "72=5+67" << std::endl << "74=3+71" << std::endl << "76=3+73" << std::endl << "78=5+73" << std::endl << "80=7+73" << std::endl << "82=3+79" << std::endl << "84=5+79" << std::endl << "86=3+83" << std::endl << "88=5+83" << std::endl << "90=7+83" << std::endl << "92=3+89" << std::endl << "94=5+89" << std::endl << "96=7+89" << std::endl << "98=19+79" << std::endl << "100=3+97";}
- 1
信息
- ID
- 401
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 3
- 标签
- 递交数
- 26
- 已通过
- 18
- 上传者