fork(2) download
  1. import java.lang.*;
  2. import java.io.*;
  3. import java.util.Scanner;
  4.  
  5. class Main {
  6. public static void main (String[] args) throws java.lang.Exception {
  7. Scanner in = new Scanner(System.in).useDelimiter("[\\s+-]");
  8. int[] dM = {31, 28, 31, 30 ,31, 30, 31, 31, 30, 31, 30, 31};
  9. double s = in.nextDouble();
  10. int p = in.nextInt();
  11. int d = in.nextInt();
  12. int day = in.nextInt();
  13. char a;
  14. int month = in.nextInt();
  15. month--;
  16. int dP = 0;
  17. for(int i = month; dP < d; i++) {
  18. double z = 0;
  19. for(int j = (i==month?day : 1); j <= dM[i] && dP < d; j++) {
  20. dP++;
  21. z += s*(p/100.0)*(1/365.0);
  22. }
  23. s += z;
  24. }
  25. System.out.printf("%.6f", s);
  26. }
  27. }
Success #stdin #stdout 0.09s 2184192KB
stdin
10000 15 90
01 01 2009
stdout
10374.436578