算法设计与分析实验.docVIP

  • 11
  • 0
  • 约8.11千字
  • 约 12页
  • 2019-02-15 发布于江苏
  • 举报
s s Integer Factorization Description 问题描述: 大于1 的正整数n可以分解为:n=X1*X2*…*Xm。 例如,当n=12 时,共有8 种不同的分解式: 12=12; 12=6*2; 12=4*3; 12=3*4; 12=3*2*2; 12=2*6; 12=2*3*2; 12=2*2*3。 编程任务: 对于给定的正整数n,编程计算n共有多少种不同的分解式。 Input 输入由多组测试数据组成。 每组测试数据输入第一行有1 个正整数n (1≤n≤2000000000)。 Output 对应每组输入,输出计算出的不同的分解式数。 Sample Input 12 Sample Output 8 程序如下: #includestdio.h #includemath.h struct DP { int num; int sum; } d[50000]={0}; int max=0; void qsort(int low,int high,struct DP key[]) { int i=low,j=high; struct DP tag=key[i]; if(ij) { do { whi

文档评论(0)

1亿VIP精品文档

相关文档