Guest User

Untitled

a guest
Jul 23rd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. import java.util.HashMap;
  2. import java.util.Scanner;
  3.  
  4.  
  5. class COINS {
  6. public static long value2(long l) {
  7. return (l < 3 || (l > value(l/2) + value(l/3) + value(l/4)) ? l : value(l/2) + value(l/3) + value(l/4));
  8. }
  9.  
  10. public static void main(String[] args) {
  11. Scanner in = new Scanner(System.in);
  12. while (in.hasNext()) {
  13. System.out.println(value2(in.nextLong()));
  14. }
  15.  
  16. }
  17. }
Add Comment
Please, Sign In to add comment