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