delete pics to save space
This commit is contained in:
33
history_source/ccf 基础篇/U8/8.6.4.cpp
Normal file
33
history_source/ccf 基础篇/U8/8.6.4.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
bool x;
|
||||
int t;
|
||||
int m;
|
||||
scanf("%d",&t);
|
||||
int sr[t];
|
||||
for(int i=0;i<t;i++) scanf("%d",sr+i);
|
||||
for(int i=0;i<t;i++)
|
||||
{
|
||||
x=0;
|
||||
for(int j=2;j<=sr[i];j++)
|
||||
{
|
||||
if(sr[i]%j==0)
|
||||
{
|
||||
if(x) printf("*");
|
||||
m=0;
|
||||
while(sr[i]%j==0)
|
||||
{
|
||||
m++;
|
||||
sr[i]/=j;
|
||||
}
|
||||
printf("%d",j);
|
||||
if(m>1) printf("^%d",m);
|
||||
x=1;
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user