백준 문제풀이

백준 11653번 - C++

diligent_gideok 2022. 5. 14. 19:25
#include <bits/stdc++.h>
using namespace std;

int main(void) {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n = 0;
	int flag = 0;
	cin >> n;
	
	for (int i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			cout << i << '\n';
			n /= i;
		}
	}
	if (n != 1) cout << n;
}

'백준 문제풀이' 카테고리의 다른 글

백준 11051번 - C++  (0) 2022.05.15
백준 11050번 - C++  (0) 2022.05.15
백준 1929번 - C++  (0) 2022.05.14
백준 1978번 - C++  (0) 2022.05.14
백준 1026번 - C++  (0) 2022.05.14