T了三个,求调
查看原帖
T了三个,求调
1121851
H_MC楼主2024/5/26 07:04
#include<bits/stdc++.h>
#define LL long long
using namespace std;
LL a,cnt,n,i,j,t;
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;
	t=n;
	i=2;
	do
	{
		while(n%i==0)
		{

			cnt++;
			n/=i;
		}
		if(cnt)
		{
			if(a==0) cout<<i,a++;
			else cout<<" * "<<i,a++;
			if(cnt>1) cout<<"^"<<cnt;
		}
		cnt=0;
		i++;
	}while(n!=1);
	return 0;
}
/*
	
*/
2024/5/26 07:04
加载中...