1 Star 0 Fork 0

ShawnBox / OI

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
HYSBZ - 2257.cpp 552 Bytes
一键复制 编辑 原始数据 按行查看 历史
ShawnBox 提交于 2018-09-02 20:54 . 2018/9/2-20:54
//
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
using namespace std;
const int MAXN=1005;
int n,k;
map<int,int> a;
map<int,int>::reverse_iterator it;
void work(int x){
for(int i=1;i*i<=x;i++){
if(x%i) continue;
a[i]++;
if(i*i!=x) a[x/i]++;
}
}
int main(){
scanf("%d%d",&n,&k);
for(int i=1;i<=n;i++){
int x;
scanf("%d",&x);
work(x);
}
for(it=a.rbegin();it!=a.rend();it++)
if(it->second>=k)
return printf("%d",it->first),0;
}
C++
1
https://gitee.com/ShawnBox/OI.git
git@gitee.com:ShawnBox/OI.git
ShawnBox
OI
OI
master

搜索帮助