15 solutions

  • 0
    @ 2022-1-18 22:10:27
    #include<iostream>
    #include<algorithm>
    #include<cstring>
    #include<cmath>
    #include<vector>
    #include<map>
    using namespace std;
    typedef long long ll; 
    int main(){
    	ios::sync_with_stdio(false);
    	ll x,ans=1;
    	cin>>x;
    	for(int i=2;i<=x/i;i++){
    		int cou=0;
    		while(x%i==0){
    			x/=i;
    			cou++;
    		}
    		if(cou&1)ans*=i;
    	}
    	if(x>1)ans*=x;
    	cout<<ans;
    
    	return 0;
    }
    

    Information

    ID
    189
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    8
    Tags
    # Submissions
    493
    Accepted
    91
    Uploaded By