fork download
  1. #include<iostream>
  2.  
  3. using namespace std;
  4.  
  5. main(){
  6. int c, v0, v1, a, l;
  7. cin >> c >> v0 >> v1 >> a >> l;
  8.  
  9. int stcl = c;
  10. int td = v0;
  11. int day = 0;
  12. while (c > 0) {
  13. day++;
  14. if (day == 1) c -= v0;
  15. else c -= v0 + l;
  16. if (c <= 0) break;
  17. v0 = min(v0+a, v1);
  18. }
  19.  
  20. cout << day << endl;
  21. }
  22.  
Success #stdin #stdout 0.01s 5284KB
stdin
15 1 100 0 0
stdout
15