import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int[]a=new int[10]; int[]num=new int[10]; int cnt=-1; for (int i = 2; i*i <=n; i++) { if(n%i==0){ cnt++; num[cnt]=i;} while(n%i==0){ a[cnt]++; n/=i; } } if(n>1){ cnt++; num[cnt]=n;a[cnt]=1; } String str=""; if(a[0]==1) str+=num[0]; else str+=num[0]+"^"+a[0]; for (int i = 1; i <=cnt; i++) { if(a[i]==1)str+="*"+num[i]; else str+="*"+num[i]+"^"+a[i]; } System.out.println(str); } }
0.0分
0 人评分
C语言训练-排序问题<1> (C语言代码)浏览:600 |
计算质因子 (C++代码)浏览:1630 |
大神老白 (C语言代码)浏览:642 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:684 |
演讲大赛评分 (C语言代码)浏览:1631 |
C语言程序设计教程(第三版)课后习题9.8 (C语言代码)浏览:609 |
2005年春浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:574 |
C语言程序设计教程(第三版)课后习题8.1 (C语言代码)浏览:565 |
C语言程序设计教程(第三版)课后习题10.1 (C语言代码)浏览:760 |
C语言程序设计教程(第三版)课后习题10.5 (C语言代码)浏览:559 |