SW Expert Academy
SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!
swexpertacademy.com
import java.util.Scanner;
import java.io.FileInputStream;
class Solution
{
public static void main(String args[]) throws Exception
{
Scanner sc = new Scanner(System.in);
int T;
T=sc.nextInt();
for(int test_case = 1; test_case <= T; test_case++)
{
int num = sc.nextInt();
int a, b, c, d, e;
a =0; b=0; c=0; d=0; e=0;
while(num%11==0){
e+=1;
num=num/11;
}
while(num%7==0){
d+=1;
num=num/7;
}
while(num%5==0){
c+=1;
num=num/5;
}
while(num%3==0){
b+=1;
num=num/3;
}
while(num%2==0){
a+=1;
num=num/2;
}
System.out.println("#" + test_case + " " + a + " " + b + " " + c + " " + d + " " + e);
}
}
}
'SWEA' 카테고리의 다른 글
[SWEA] 가랏! RC카! (0) | 2024.10.08 |
---|---|
[SWEA] 간단한 압축 풀기 (0) | 2024.10.06 |
[SWEA] 날짜 계산기 (0) | 2024.10.04 |
[SWEA] 두 개의 숫자열 (0) | 2024.10.04 |
[SWEA] 숫자를 정렬하자 (0) | 2024.09.30 |