From d71d5e8ad889774961a58e4cb61cd74e88f2f36a Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Thu, 19 Aug 2021 16:50:00 +0800 Subject: [PATCH] =?UTF-8?q?867.=20=E5=88=86=E8=A7=A3=E8=B4=A8=E5=9B=A0?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.acwing.com/problem/content/submission/code_detail/7241866/ --- AcWing/867/867.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 AcWing/867/867.cpp diff --git a/AcWing/867/867.cpp b/AcWing/867/867.cpp new file mode 100644 index 00000000..6f73073a --- /dev/null +++ b/AcWing/867/867.cpp @@ -0,0 +1,27 @@ +#include + +using namespace std; + +int n, a; + +int main() { + cin >> n; + while (n--) { + cin >> a; + for (int i = 2; i * i <= a; i++) { + if (a % i == 0) { + int s = 0; + while (a % i == 0) { + a /= i; + s++; + } + cout << i << ' ' << s << endl; + } + } + if (a > 1) { + cout << a << ' ' << 1 << endl; + } + cout << endl; + } + return 0; +}