This commit is contained in:
HuangHai
2025-08-30 18:35:01 +08:00
commit 1f397eca87
6258 changed files with 1487241 additions and 0 deletions

32
TangDou/KaoShi/BABA_5.cpp Normal file
View File

@@ -0,0 +1,32 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> count(81, 0);
for (int i = 0; i < n; ++i) {
int num;
cin >> num;
count[num]++;
}
for (int i = 1; i <= 80; ++i) {
if (count[i] >= 2) {
count[i + 1] += count[i] / 2;
count[i] %= 2;
}
}
int max_num = 0;
for (int i = 1; i <= 80; ++i) {
if (count[i] > 0) {
max_num = i;
}
}
cout << max_num << endl;
return 0;
}