把网站做成app多少钱,建网站 主流软件,推广网站哪家做的好,营销管理网站制作3
10
9
Example
input
3
8
1 4 8 4 5 6 3 8
16
2 1 3 3 4 3 4 4 1 3 2 2 2 4 1 1
9
2 2 4 4 4 7 7 7 7
output 题意#xff1a; n个糖果#xff0c;分为多个种类#xff0c;要求尽可能的多选#xff0c;并且使得不同种类的数量不能相同。
解析#xff1a; 记录每种糖…3
10
9
Example
input
3
8
1 4 8 4 5 6 3 8
16
2 1 3 3 4 3 4 4 1 3 2 2 2 4 1 1
9
2 2 4 4 4 7 7 7 7
output 题意 n个糖果分为多个种类要求尽可能的多选并且使得不同种类的数量不能相同。
解析 记录每种糖果的数量然后排序对于每种糖果尽可能的多拿并且保证数量不同。
#includebits/stdc.h
using namespace std;
typedef long long ll;
const int N2e55;
int q,n,a[N],t;
int main(){scanf(%d,q);while(q--){scanf(%d,n);mapint,intmp; for(int i0;in;i){scanf(%d,t);mp[t];}vectorinta;for(auto it:mp){a.push_back(it.second);}sort(a.begin(),a.end());int res0,f2e51;for(int ia.size()-1;i0;i--){if(a[i]0||f0) break;if(a[i]f) resf,f-1;else resa[i],fa[i]-1;} printf(%d\n,res);}return 0;
}