poj 3421 X-factor Chains
来源:互联网 发布:unity3d场景制作 编辑:程序博客网 时间:2024/06/05 03:02
素因子分解,求所有素因子的全排列
#include <stdio.h>#include <string.h>int fac[30];int cnt[30];int len;long long Factorial(long long num){ long long ret = 1; for(long long i = 1; i <= num; ++i) ret *= i; return ret;}int main(){ int num,rlen; while(scanf("%d",&num) != EOF) { memset(cnt,0,sizeof(cnt)); len = rlen = 0; for(int i = 2; i*i <= num; ++i) { if(num%i == 0) { fac[len] = i; while(num%i == 0) { num /= i; cnt[len]++; rlen++; } len++; } } if(num > 1) { fac[len] = num; cnt[len++] = 1; rlen++; } long long res = Factorial(rlen); for(int i = 0; i < len; ++i) res /= Factorial(cnt[i]); printf("%d %lld\n",rlen,res); } return 0;}
阅读全文
0 0
- POJ-3421-X-factor Chains
- poj 3421 X-factor Chains
- Poj 3421-X-factor Chains
- POJ 3421 X-factor-Chains
- poj 3421 X-factor Chains
- poj 3421 --X-factor Chains(数学、组合)
- POJ 3421 X-factor Chains 排列组合
- POJ 3421 - X-factor Chains(数学)
- X-factor Chains (poj 3421 数学排列组合)
- poj 3421 X-factor Chains(分解质因数+组合数学)
- POJ 3421 X-factor Chains (约数枚举)
- POJ 3421X-factor Chains【分解质因子+组合数学】
- POJ 3421 X-factor Chains(数论)(筛法)()
- POJ 3421 X-factor Chains 已被翻译
- poj 3421 X-factor Chains(数因子分解)
- poj 3421 X-factor Chains 素数筛选 因子分解
- POJ 3421 X-factor Chains 分解质因数 排列组合
- 码农场 » POJ 3421 X-factor Chains 题解 《挑战程序设计竞赛》
- PAT 甲级 1090. Highest Price in Supply Chain (25)
- POJ 1811 Prime Test 【快速判质+因子分解】【模板】
- The Design of COVE: a Collaborative Ocean Visualization Environment
- 2017.10.06【NOIP提高组】模拟赛B组 整除 题解
- LeetCode-93-Restore IP Addresses 暴力
- poj 3421 X-factor Chains
- Codeforces 858F ( Codeforces Round #434 Div. 2 F ) Wizard's Tour 图论dfs
- 蓝桥杯 算法提高 数字黑洞
- Hadoop Yarn初探
- 常用算法
- 第五周项目2
- 简单模拟——LRC才不会告诉你们的事情
- 位图显示和图形界面技术(操作系统桌面显示技术)
- JavaScript 事件入门