jej333
查看原帖
jej333
1064094
jej333楼主2025/1/29 10:19
#include<bits/stdc++.h>
using namespace std;
unsigned long long a,cnt,b=2;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>a;
	for(unsigned long long i=2;i<=a/2;i++){
		while(a%i==0){
			a/=i;
			cnt++;
		}
		if(a!=1){
			if(cnt==1) cout<<i<<" * ";
			else if(cnt!=0) cout<<i<<'^'<<cnt<<" * ";
		}else{
			if(cnt==1) cout<<i;
			else if(cnt!=0) cout<<i<<'^'<<cnt;
		}
		cnt=0;
	}
	if(a!=1) cout<<a;
	return 0;
}

70分,t了三个点,求调(要是变成i<=sprt(a)会wa)

2025/1/29 10:19
加载中...