fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. HashMap<Long, Long> map = new HashMap<>();
  13. map.put((long)1, (long)20);
  14. map.put((long)2, (long)36);
  15. map.put((long)3, (long)51);
  16. map.put((long)4, (long)60);
  17. int t = Integer.parseInt (br.readLine());
  18. while(t-->0){
  19. long n = Long.parseLong(br.readLine());
  20. long y = n%4;
  21. long x = n/4;
  22. long sum = 0;
  23.  
  24. if(x>0){
  25. x--;
  26. if(y>0)
  27. sum = x*44 + (4-y)*15 + y*11 + map.get(y);
  28. else
  29. sum = x*44 + map.get((long)4);
  30.  
  31. }else{
  32. sum = map.get(y);
  33. }
  34.  
  35. System.out.println (sum);
  36. }
  37. // your code goes here
  38. }
  39. }
Success #stdin #stdout 0.08s 47288KB
stdin
1
3
stdout
51