L. Bridge Renovation · znzryb
## 思路讲解
我反正贪心过的,n比较小,所以全部是循环。
先尝试性价比比较高的,再尝试性价比比较低的
## AC代码
[https://codeforces.com/contest/2038/submission/293535960](https://codeforces.com/contest/2038/submission/293535960)
```cpp
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
void solve(ll n){
ll a=n,b=n,c=n;
ll cnt=0;
while (a>=1 && b>=2){
a-=1;
b-=2;
++cnt;
}
while (a>=3) {
a-=3;
++cnt;
}
while (a>=1 && c>=1){
a-=1,c-=1;
++cnt;
}
while (b>=1 && c>=1) {
b-=1;
c-=1;
++cnt;
}
while (c>=1) {
c-=2;
++cnt;
}
while (b>=1) {
b-=2;
++cnt;
}
while (a>=1) {
a-=2;
++cnt;
}
cout<<cnt<<endl;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
ll n;
cin>>n;
solve(n);
return 0;
}
// AC https://codeforces.com/contest/2038/submission/293535960
```
## 心路历程(WA,TLE,MLE……)