BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(bf.readLine(), "\n");
int N = Integer.parseInt(st.nextToken());
List<Integer> list = new ArrayList<>();
// 소인수분해
for (int i=2; i<=N; i++) {
while(N%i==0) {
list.add(i);
N = N/i;
}
}
// list에서 특정 글자의 개수를 세려면?
long a = list.stream().filter(n->n==2).count();
long b = list.stream().filter(n->n==3).count();
long c = list.stream().filter(n->n==5).count();
long d = list.stream().filter(n->n==7).count();
long e = list.stream().filter(n->n==11).count();
System.out.print(a + " " + b + " " + c + " " + d + " " + e);
}
카테고리 없음
댓글