From c22482f345a004ee3b78f8d35410d0a50584bbb0 Mon Sep 17 00:00:00 2001 From: ji-junhyuk Date: Fri, 20 Jan 2023 07:43:20 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20solve=201929,=20=EC=86=8C=EC=9D=B8?= =?UTF-8?q?=EC=88=98=EB=B6=84=ED=95=B4(math-factorization,=20b1,=2015m)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- junji/math/11653.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 junji/math/11653.cpp diff --git a/junji/math/11653.cpp b/junji/math/11653.cpp new file mode 100644 index 0000000..8a035c7 --- /dev/null +++ b/junji/math/11653.cpp @@ -0,0 +1,39 @@ +#include +#include +#include +#include +#include +#include +#include +using namespace std; + +int N; + +void get_input() +{ + cin >> N; +} + +int main(void) +{ + ios::sync_with_stdio(false); + cin.tie(NULL); + + get_input(); + vector primes; + + int start = 1; + int backup = N; + for (int i = 2; i <= N / i; ++i) + { + while (N % i == 0) + { + primes.push_back(i); + N /= i; + } + } + if (N != 1) + primes.push_back(N); + for (int i = 0; i < primes.size(); ++i) + cout << primes[i] << '\n'; +}