문제 링크 : https://www.swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5Pl0Q6ANQDFAUq


문제의 저작권은 SW Expert Academy에 있습니다.



#include <iostream>
 
using namespace std;
 
int main(void) {
    int T, N, cnt[5], num[5= {235711};
    cin >> T;
 
    for(int t_case=0; t_case<T; t_case++) {
        cin >> N;
 
        for(int i=0; i<5; i++) {
            cnt[i] = 0;
            while(N%num[i] == 0) {
                cnt[i]++;
                N /= num[i];
            }
        }
 
        cout << "#" << t_case+1;
        for(int i=0; i<5; i++)
            cout << " " << cnt[i];
        cout << "\n";
    }
 
    return 0;
}
cs

'C & C++ > SW Expert Academy' 카테고리의 다른 글

SWEA 1928 - Base64 Decoder  (0) 2018.04.28
SWEA 1940 - 가랏! RC카!  (0) 2018.04.28
SWEA 1946 - 간단한 압축 풀기  (0) 2018.04.28
SWEA 1948 - 날짜 계산기  (0) 2018.04.28
SWEA 1954 - 달팽이 숫자  (0) 2018.04.28

+ Recent posts