玄关
查看原帖
玄关
1073741
UKE_bound楼主2024/5/5 11:21
#include<bits/stdc++.h>
using namespace std;
int x;
int s,t,m=0x7fffffff;
void f(int a){
	int c=a;
	for(int i=2;i<a>>1;i++){
		if(!(c%i)){
			s++;
			m=min(m,i);
			while(!(c%i)){
				c/=i;
				t++;
			}
		}
	}
	if(!s){
		s++;
		t++;
		m=a;
	}
}
int main(){
	cin>>x;
	f(x);
	if(s==1){
		cout<<x;
	}else if(t%2&&s==t){
		cout<<m;
	}else{
		cout<<1;
	}
	return 0;
}

https://www.luogu.com.cn/record/158066560

2024/5/5 11:21
加载中...