Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.HashMap;
- import java.util.Scanner;
- class COINS {
- public static long value2(long l) {
- return (l < 3 || (l > value(l/2) + value(l/3) + value(l/4)) ? l : value(l/2) + value(l/3) + value(l/4));
- }
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- while (in.hasNext()) {
- System.out.println(value2(in.nextLong()));
- }
- }
- }
Add Comment
Please, Sign In to add comment