求调,60分,其余全超时。
查看原帖
求调,60分,其余全超时。
1539028
dingjingxuan1234楼主2024/10/25 20:42
#include <bits/stdc++.h>
using namespace std;
bool zhishu(int zs){
	for(int j=2;j<=zs;j++){
		if(zs%j==0){
			return 0;
		}
		if(zs>1){
			return 1;
		}
	}
}
int main(){
	long long n;
	cin>>n;
	for(int i=n-1;i>=2;i--){
		if(zhishu(i)&&n%i==0){
			cout<<i;
			return 0;
		}
	}
}
2024/10/25 20:42
加载中...