2019-3-24
阿新 • • 發佈:2019-03-24
pac region bit mic reg chm fine con its
http://codeforces.com/gym/101982/attachments/download/7897/20182019-acmicpc-pacific-northwest-regional-contest-div-1-en.pdf
#include<bits/stdc++.h> using namespace std; #define ll long long bool notp[1000005]; int prime[1000005]; int x[1000005]; int cnt=0; void init(){ notp[1]=1; for(int i=2;i<=1000000;i++){ if(notp[i]) ; else{ prime[cnt++]=i; for(int j=i+i;j<=1000000;j+=i) notp[j]=1; } } } int main(){ init(); for(int i=4;i<=1000000;i+=2){ for(int j=0;j<cnt&&prime[j]<=i;j++){ if(notp[i-prime[j]]==0){ /*if(j>100) cout<<i<<"!"<<j<<endl;*/ x[i]=prime[j]; break; } } } int X; int ans=0; while(cin>>X){ ans=0; while(X>=4){ X=X-2*x[X]; ans++; } cout<<ans<<endl; } }
2019-3-24