fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n, k;
  6. double waterPerTree = 0;
  7. cin >> n;
  8. int days = 0;
  9. while(waterPerTree <= 0.5) {
  10. waterPerTree += (double) 1 / (n - days++);
  11. }
  12. k = n - days +1;
  13. cout << k;
  14. return 0;
  15. }
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
19874