您最近发帖好频繁
by 紬文德斯 @ 2019-01-30 14:29:45
qwq
by 深渊龙谷 @ 2019-01-30 14:30:04
@[深渊龙谷](/space/show?uid=123889) 这道题要排序吧
by qian_shang @ 2019-01-30 14:31:02
排了还是不对
by 深渊龙谷 @ 2019-01-30 14:33:50
@[小梁](/space/show?uid=64175)
by 深渊龙谷 @ 2019-01-30 14:34:35
@[深渊龙谷](/space/show?uid=123889) 感觉你的思路怪怪的
by qian_shang @ 2019-01-30 14:35:51
@[小梁](/space/show?uid=64175) 只能拿60分QAQ
by 深渊龙谷 @ 2019-01-30 14:37:09
@[深渊龙谷](/space/show?uid=123889) 我给你改了一下,A了
```
#include <bits/stdc++.h>
using namespace std;
int a[100010],n,m,p,q,t,pp;
bool cmp(int x,int y) {return x>y;}
int minn(int pp,int qq){return pp<qq ?pp :qq;}
int main()
{
scanf("%d%d",&n,&m);
for (int i=1;i<=m;i++)
scanf("%d",&a[i]);
sort(a+1,a+1+m,cmp);
for (int i=1;i<=m;i++)
{
p=a[i]; q=i;
q=minn(q,n);
if (q*p>=t) {t=q*p;pp=p;}
}
printf("%d %d",pp,t);
return 0;
}```
by qian_shang @ 2019-01-30 14:44:13
@[深渊龙谷](/space/show?uid=123889) 那个minn函数可以不管他,就是min
by qian_shang @ 2019-01-30 14:44:41
谢谢大佬
by 深渊龙谷 @ 2019-01-30 14:45:09