fork download
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5. int main() {
  6. double s;
  7. int p, d;
  8. int dM[12] = {31, 28, 31, 30 ,31, 30, 31, 31, 30, 31, 30, 31};
  9. cin>>s>>p>>d;
  10. int day, month;
  11. char a;
  12. cin>>day>>a>>month;
  13. month--;
  14. int dP = 0;
  15. for(int i = month; dP < d; i++){
  16. double z = 0;
  17. for(int j = (i==month?day : 1); j <= dM[i] && dP < d; j++){
  18. dP++;
  19. z += s*(p/100.0)*(1/365.0);
  20. }
  21. s += z;
  22. }
  23. cout<<fixed<<setprecision(6)<<s;
  24. return 0;
  25. }
Success #stdin #stdout 0s 4508KB
stdin
10000 15 90
01-01-2009
stdout
10374.436578