백준 - 로마 숫자 만들기
내 풀이
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class baekjoon_16922 {
static int[] romans = new int[]{1, 5, 10, 50};
static Set<Integer> ansSet = new HashSet<>();
static int N;
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
N = Integer.parseInt(br.readLine());
for (int a = 0; a <=N; a++) {
for (int b = 0; b <= N - a; b++) {
for (int c = 0; c <= N - a - b; c++) {
solve(a, b, c, N - a -b -c);
}
}
}
System.out.println(ansSet.size());
}
private static void solve(int a, int b, int c, int d) {
ansSet.add(romans[0] * a + romans[1] * b + romans[2] * c + romans[3] * d);
}
}