提交时间:2021-05-16 16:39:22

运行 ID: 19525

#include<bits/stdc++.h> using namespace std; int All_Floor,MAXN_Floor; int IsPrime(int x){ for(int i=2;i*i<=x;i++){ if(x%i==0) return 0; } return 1; } int IsDouble(int x){ int Count; while(x){ if(x%2==1) Count++; x/=2; } if(Count%2==0) return 1; return 0; } int main(){ for(int i=1;i<=100;i++){ if(IsPrime(i)&&IsDouble(i)){ MAXN_Floor=i; All_Floor+=i; } } cout<<All_Floor<<" "<<MAXN_Floor; return 0; }