Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: thitit

Problemset: แยกตัวประกอบ

Language: cpp

Time: 0.143 second

Submitted On: 2026-11-09 15:41:27

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main () {
    cin.tie(0)->sync_with_stdio(false);
    int x;
    cin >> x;
    int temp;
    int count = 0;
    for (int i = 2; i <= x; i++) {
        if (x % i == 0) {
            temp = x;
            count = 0;
            while (temp % i == 0) {
                temp = temp / i;
                x = x / i;
                count++;
            }
            cout << i << "^" << count << " ";
        }

    }
}