AcWing 4409. 砍竹子
原题链接
困难
作者:
on1
,
2024-02-19 19:30:42
,
所有人可见
,
阅读 38
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#define pb push_back
#define ioputs ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define endl '\n'
using namespace std;
using ll = long long;
const int N = 2e5 + 100;
vector<ll> vec[N];
ll n, ans, cnt;
void cuts(ll &hs)
{
hs = sqrtl(hs/2 + 1);
}
signed main()
{
ioputs;
cin >> n;
while (n -- )
{
ll tmp;
cin >> tmp;
while (tmp > 1)
{
bool flag = 0;
vec[cnt + 1].pb(tmp);
for (ll x : vec[cnt])
{
if (tmp == x)
{
flag = 1;
break;
}
}
if (!flag) ans ++;
cuts(tmp);
}
cnt ++;
}
cout << ans << endl;
return 0;
}