mirror of
https://github.com/wczffl-503/OI-Codes.git
synced 2025-07-08 02:13:51 +08:00
更新了许多
This commit is contained in:
26
哥德巴赫猜想.cpp
Normal file
26
哥德巴赫猜想.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int a,flag1=1,flag2=1;
|
||||
cin >>a;
|
||||
for(int i=2;i<=a-2;i++){
|
||||
for(int j=2;j<i;j++){
|
||||
if(i%j==0){
|
||||
flag1=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for(int k=2;k<a-i;k++){
|
||||
if((a-i)%k==0){
|
||||
flag2=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(flag1==1 && flag2==1){
|
||||
cout <<a<<"="<<i<<"+"<<a-i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user