08-14-25
This commit is contained in:
25
Luogu/P1007 独木桥.cpp
Normal file
25
Luogu/P1007 独木桥.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int length, n;
|
||||
int tmp;
|
||||
int js;
|
||||
vector<int> ma, mi;
|
||||
cin >> length >> n;
|
||||
for(int i = 0;i < n; i++){
|
||||
cin >> tmp;
|
||||
js = max(length - tmp + 1, tmp);
|
||||
ma.push_back(js);
|
||||
js = min(length - tmp + 1, tmp);
|
||||
mi.push_back(js);
|
||||
}
|
||||
int smax = 0;
|
||||
int smax2 = 0;
|
||||
for(int i = 0;i < n; i++){
|
||||
if(ma.at(i) > smax) smax = ma[i];
|
||||
if(mi[i] > smax2) smax2 = mi[i];
|
||||
}
|
||||
cout << smax2 << " " << smax;
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user