# Editorial

This problem says that on the day of planting, the gardener had to use a bucket of water for each of the trees, on the last day - $N1 $, on the second to last $N−11 $, and so on. The gardener waters the trees with the following amounts of water $1,21 ,31 ,...,N1 $. Meaning that the gardener must water the trees for $N$ days.

We don't know what day the gardener started watering the trees, but we do know that he watered the trees on the last day, and in total used no more than $21 $ buckets of water. Therefore, we can count how many days the gardener watered the trees moving from the last day.

Knowing the total number of days the gardener planned to water the trees ($N$) and the number of days the gardener actually watered the trees, we can find $K$, the number of days the gardener missed.

#include <bits/stdc++.h> using namespace std; int main() { int n, m = 0; cin>>n; // Read the number of trees double v = 0; for (int i = n; i >= 1; --i) { v += 1.0 / i; if (v > 0.5) { // Make sure that the total amount of water does not exceed half a bucket break } m++; // Let's count the number of days the gardener watered the trees } cout<<n - m<<"\n"; }