1 solutions

  • 0
    @ 2025-11-5 17:08:02

    C++ :

    #include <bits/stdc++.h>
    #define LL long long
    using namespace std;
    
    void f(LL x) {
    	for (LL i = 2; i <= x / i; i ++) {
    		while (x % i == 0) {
    			cout << "    " << i << endl;
    			x /= i;
    		}
    	}
    	if (x > 1) cout << "    " << x << endl;
    	cout << endl;
    }
    
    int main() {
    	LL n;
    	while (cin >> n && n >= 0) {
    		f(n);
    	}
    
    	return 0;
    }
    
    
    • 1

    Information

    ID
    18195
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By