- 选食物
int main()
{
int n;
cin >> n;
long long f[90];
f[0] = 0;
f[1] = 2;
f[2] = 3;
for (int i = 3; i <= n; i++)
{
f[i] = f[i - 1] + f[i - 2];
}
cout << f[n] << endl;
system("pause");
return 0;
}
- 盒子
int main()
{
int n;
cin >> n;
vector<long> vc(n);
for (int i = 0; i < n; i++)
{
cin >> vc[i];
}
sort(vc.begin(), vc.end());
map<long, int> m;
for (size_t i = 0; i < vc.size(); i++)
{
m[vc[i]]++;
}
int max = 0;
for (auto e : m)
{
if (e.second > max) max = e.second;
}
cout << max << endl;
system("pause");
return 0;
}
#爱奇艺##笔试题目#