开始计概A下半学期。
This commit is contained in:
1 parent
0cfdc8499c
commit
38e97654e1
31 files changed
+2144
-110
No files matched your search
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 特别处理有一个杆子超级长?
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
std::cin.tie(nullptr);
|
||||
|
||||
int n;
|
||||
std::cin >> n;
|
||||
|
||||
std::vector<int> half_lengths;
|
||||
half_lengths.reserve(2 * n);
|
||||
for (int i = 0; i < n; i++) {
|
||||
int length, flag_pos;
|
||||
std::cin >> length >> flag_pos;
|
||||
half_lengths.push_back(length - flag_pos);
|
||||
half_lengths.push_back(flag_pos);
|
||||
}
|
||||
std::sort(half_lengths.begin(), half_lengths.end(), std::greater<>());
|
||||
|
||||
std::cout << half_lengths[0] + half_lengths[1] << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user