提交时间:2021-05-27 22:06:30

运行 ID: 20022

#include<iostream> #include<cstdio> using namespace std; int check(int x) { int i,tot=0; if(x<2)return 0; for(i=2;i*i<=x;++i) if(x%i==0)return 0; while(x>0){ tot=tot+x&1; x=x/2; } if(tot%2==0)return 1; return 0; } int main() { int n,i,ii,tot=0; cin>>n; for(i=1;i<=n;++i){ if(check(i)){ ii=i;tot++; } } cout<<tot<<","<<ii<<endl; return 0; }