// lanqiao 2107 修剪灌木(模拟法)
This commit is contained in:
37
13lanqiao/test4-1.cpp
Normal file
37
13lanqiao/test4-1.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
// lanqiao 2107 修剪灌木(模拟法)
|
||||
#include<bits/stdc++.h>
|
||||
using namespace std;
|
||||
const int N = 1e4 + 10;
|
||||
int mxh[N];
|
||||
int main(){
|
||||
int n; cin >> n;
|
||||
vector<int> h(n);
|
||||
for(int d = 1; d <= n; d++){
|
||||
for(int i = 0; i < h.size(); i++){
|
||||
h[i] += 1;
|
||||
h[d-1] = 0;
|
||||
mxh[i] = max(mxh[i], h[i]);
|
||||
}
|
||||
}
|
||||
for(int d = n; d >= 1; d--){
|
||||
for(int i = 0; i < h.size(); i++){
|
||||
h[i] += 1;
|
||||
h[d-1] = 0;
|
||||
mxh[i] = max(mxh[i], h[i]);
|
||||
}
|
||||
}
|
||||
for(int d = 1; d <= n; d++){
|
||||
for(int i = 0; i < h.size(); i++){
|
||||
h[i] += 1;
|
||||
h[d-1] = 0;
|
||||
mxh[i] = max(mxh[i], h[i]);
|
||||
}
|
||||
}
|
||||
for(int i = 0; i < h.size(); i++){
|
||||
cout << mxh[i] << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/* test samples -> 4 2 4
|
||||
3
|
||||
*/
|
||||
Reference in New Issue
Block a user