vijos时光的秘密模拟赛(t1)

来源:互联网 发布:甜椒刷机软件 编辑:程序博客网 时间:2024/06/06 05:52


/*该死的出题人,还莫比乌斯反演....*/

/*不过我的做法好像也对啊,不知为何错了*/

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
using namespace std;
typedef long long ll;
ll k,cnt=0,prime[]={0,2,3,5,7,11,13,17,19,23,29},num[2010];
map<int,int> a;
void dfs(int x,ll now){
 if(!a.count(now)){
  num[++cnt]=now;
  a[now]=1;
 }
 if(x>10) return;
 dfs(x+1,now*prime[x]);
 dfs(x+1,now);
}
int main(){
 cin>>k;
 dfs(1,1);
 sort(num+1,num+1+cnt);
 int cur=0,cur1;
 for(int i=1;i<=cnt;i++){
  if(num[i]<=k){
   ++cur;
  }
  else break;
 }
 ll now=0,now1=k;
 while(true){
  if(now==cur) break;
  ++now1;
  if(!a.count(now1)){
   ++now;
   //cout<<now1<<' ';
  }
 }
// cout<<endl;
 cout<<now1<<endl;
 return 0;
}

原创粉丝点击