时间限制: 1000 ms 空间限制: 262144 KB
题目描述

输入

输出

样例输入1
样例输入2
样例输出1
样例输出2
数据范围限制

代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| #include<bits/stdc++.h> using namespace std; int n,v,k=1,maxx=-0x3f3f3f,a[100001],t[100001],b[100001]; void g(int x) { for(int i=1;i*i<=x;i++) { if(x%i==0) { t[i]++; t[x/i]++; if(i*i==x) t[i]--; } } } int main() { freopen("template.in","r",stdin); freopen("template.out","w",stdout); scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%d",&v); g(v); if(v>maxx) maxx=v; } for(int i=maxx;i>=1;i--) { while(t[i]>=k) { b[k]=i; k++; } } for(int i=1;i<=n;i++) printf("%d\n",b[i]); return 0; }
|
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 暗影小站! 注: 本博客暂不开设评论区,请使用邮件119548583@qq.com联系