链接:http://codeforces.com/contest/1011/problem/B
题意:是有n个人,m个食物,然后输入m个食物的所属类,比如1,2,3,就分别表示第一类食物,第二类食物,第三类食物,然后这n个人每个人要挑一类食物吃,而且接下来的几天中也只能吃这一类食物,比如说A第一天吃第一类食物,那么第二天也得吃第一类食物,然后问这n个人最多能活多少天(能吃多少天)。
思路:暴力枚举就行了。
#include<bits/stdc++.h>
using namespace std;
const int maxn = 100+7;
#define ll long long
inline int read()
{
char ch = getchar(); int x = 0, f = 1;
while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
while('0' <= ch && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}
return x * f;
}
int n, m, x, cnt, v[maxn];
int main()
{
int m = read(), n = read(), ans = 0;
for(int i = 1; i <= n; i++) x = read(), v[x]++;
for(int i = n; i > 0; i--)
{
int s = 0;
for(int j = 1; j <= 100; j++) s += v[j] / i;
if(s >= m)
{
ans = i;
break;
}
}
cout << ans <<endl;
}