Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
543
//g++ 5.4.0 #include <iostream> #include <vector> using namespace std; int main() { int entrada,resta; bool nope; vector<int> criba(1000000,0); criba[1]=criba[0]=1; for(int i=2; i<1000000; i++){ if(criba[i]==0){ for(int j=i; j<1000000/i; j++){ criba[i*j]=1; } } } while(true){ nope=false; cin>>entrada; if(entrada==0) break; for(int i=2; i<1000000; i++){ if(criba[i]==0){ resta=entrada-i; if(criba[resta]==0){ cout<<entrada<<" = "<<i<<" + "<<resta<<"\n"; nope=true; break; } } } if(!nope) cout<<"Goldbach's conjecture is wrong.\n"; } }
run
|
edit
|
history
|
help
0
sysFork3
Rev Fact WIP
SetHotel
series kv type 1
Stream7
cache 内存消耗
Template HeapSort
11933
Dar
12532