1 solutions

  • 0
    @ 2022-5-29 16:10:52
    #include <bits/stdc++.h>
    using namespace std;
    #define accelerate ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
    #define endl "\n";
    #define mod 12345
    #define ll long long
    #define PII pair<int,int>
    #define INF 0x3f3f3f3f
    const int N=1e5+10;
    ll n,m,k,x,y,T;
    ll a[N];
    ll pre[N];
    bool f(int x){
    	if(x==0||x==1) return 0;
    	for(int i=2;i*i<=x;i++){
    		if(x%i==0) return 0;
    	}
    	return 1;
    }
    int main(){
    	accelerate;
    	cin>>n;
    	while(n>1){
    		for(int i=2;i<=n;i++){
    			if(f(i)&&n%i==0){
    				n/=i;
    				cout<<i<<endl;
    				break;
    			}
    		}
    	}
    	return 0;
    }
    
    • 1

    Information

    ID
    421
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    10
    Tags
    # Submissions
    6
    Accepted
    5
    Uploaded By