LightOJ 1035 Intelligent Factorial Factorization 因子分解水题
来源:互联网 发布:复杂网络的实际应用 编辑:程序博客网 时间:2024/05/16 11:45
题目:http://www.lightoj.com/volume_showproblem.php?problem=1023
题意:给一个数n,把n!写成因子相乘的形式,* a (b)意味a是n!的因子,b是n!中a的个数
思路:数据范围很小,直接暴力分解因子即可
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <queue>using namespace std;const int N = 110;int cas;int main(){ int t, n; scanf("%d", &t); while(t--) { int num[N]; memset(num, 0, sizeof num); scanf("%d", &n); for(int i = 2; i <= n; i++) { int m = i, j = 2; while(m != 1) { while(m % j == 0) num[j]++, m /= j; j++; } } printf("Case %d: %d = ", ++cas, n); bool flag = false; for(int i = 2; i <= n; i++) if(num[i]) { if(!flag) printf("%d (%d)", i, num[i]), flag = true; else printf(" * %d (%d)", i, num[i]); } printf("\n"); } return 0;}
0 0
- LightOJ 1035 Intelligent Factorial Factorization 因子分解水题
- LightOJ 1035 Intelligent Factorial Factorization [预处理+一半的 质因子分解]【数论】
- LightOJ 1035 - Intelligent Factorial Factorization (求因子)
- LightOJ 1035 Intelligent Factorial Factorization
- LightOJ 1035 Intelligent Factorial Factorization
- LightOJ 1035 Intelligent Factorial Factorization
- Intelligent Factorial Factorization LightOJ
- lightoj 1035 Intelligent Factorial Factorization 因式分解
- LightOJ 1035 Intelligent Factorial Factorization 全排列
- Light OJ 1035 - Intelligent Factorial Factorization
- Light OJ 1035 Intelligent Factorial Factorization
- 素因子分解 Prime factorization
- LightOJ1035 Intelligent Factorial Factorization(算数基本定理)
- 隐因子分解机Factorization Machine
- 隐因子分解机Factorization Machine
- Lightoj 1341(质因子分解)
- lightoj 1116 - Ekka Dokka 【分解因子】
- LightOJ 1014 Ifter Party 分解因子
- JAVA基础6.44——单例设计模式
- 【源码剖析】threadpool —— 基于 pthread 实现的简单线程池
- 编译原理:LL(1)文法 语法分析器(预测分析表法)
- 9.8
- 第03章:java数据类型
- LightOJ 1035 Intelligent Factorial Factorization 因子分解水题
- python学习(一) 根据廖雪峰老师的资料进行自学
- 状态栏攻略
- node Express安装和使用
- 栈和队列的基础算法学习
- bzoj1648(水)
- View类xml属性、方法
- 函数调用
- 关于华为EMUI4.0忽略电池优化失败的问题