fork(1) download
  1. #include <cstdio>
  2. #include <cmath>
  3.  
  4. int main()
  5. {
  6. double k, p, s, years;
  7. scanf("%lf %lf %lf", &k, &p, &s);
  8. if( s<=k )
  9. {
  10. years=0;
  11. printf("%ld", years);
  12. }
  13. else
  14. {
  15. years = log( s/k )/log( 1 + (p/100) );
  16. //применяя функцию округления до ближайшего большего целого, рассчитать количество лет
  17. printf("%2.0lf", ceil(years) );
  18. }
  19. return 0;
  20. }
Success #stdin #stdout 0s 3344KB
stdin
 0 0 0
20 10 20
20 10 30 
0.6 30 21
1.14 0.08 40.00
1000 20 800
stdout
Standard output is empty