社区讨论
T了三个,求调
B3871[GESP202309 五级] 因数分解参与者 3已保存回复 3
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 3 条
- 当前快照
- 1 份
- 快照标识符
- @lwmpyuoz
- 此快照首次捕获于
- 2024/05/26 07:05 2 年前
- 此快照最后确认于
- 2024/05/26 10:11 2 年前
CPP
#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;
}
/*
*/
回复
共 3 条回复,欢迎继续交流。
正在加载回复...