题意 求n!的因子数%1e9+7. 思路 由唯一分解定理,一个数可以拆成素数幂之积,即2^a * 3^b *……,n!=2*3*……*n,所以计算每个素因子在这些数中出现的总次数(直接对2~n素因子分解即可),再用唯一分解定理公式,因子数=(a+1)*(b+1)*……. 代码 #include<bits/stdc++.h> using namespace std; #define inf 0x3f3f3f3f #define ll long long const int N=200005; c…
[唯一分解定理]:https://www.cnblogs.com/mjtcn/p/6743624.html 假设x是一个正整数,它的值不超过65535(即1<x<=65535),请编写一个程序,将x分解为若干个素数的乘积. Input 输入的第一行含一个正整数k (1<=k<=10),表示测试例的个数,后面紧接着k行,每行对应一个测试例,包含一个正整数x. Output 每个测试例对应一行输出,输出x的素数乘积表示式,式中的素数从小到大排列,两个素数之间用“*”表示乘法. Samp…
题目链接:https://cn.vjudge.net/problem/HDU-1215 题意 中文题,自己去看吧,懒得写:) 思路 \[ Ans=\prod \sum p_i^j \] 唯一分解定理 关键在于求因子了,模版到时候整理 提交过程 AC 代码 #include <cstdio> #include <cstring> #include <algorithm> using namespace std; int factors[200][2], fsize; vo…
人生第一场 AtCoder,纪念一下 话说年后的 AtCoder 比赛怎么这么少啊(大雾 AtCoder Beginner Contest 154 题解 A - Remaining Balls We have A balls with the string S written on each of them and B balls with the string T written on each of them. From these balls, Takahashi chooses one…
目录 AtCoder Beginner Contest 153 题解 A - Serval vs Monster 题意 做法 程序 B - Common Raccoon vs Monster 题意 做法 程序 C - Fennec vs Monster 做法 程序 D - Caracal vs Monster 做法 程序 E - Crested Ibis vs Monster 做法 程序 F - Silver Fox vs Monster 做法 程序 感谢 AtCoder Beginner Co…
You are given an array aa consisting of nn integers. Your task is to say the number of such positive integers xx such that xx divides eachnumber from the array. In other words, you have to find the number of common divisors of all elements in the arr…
AtCoder Beginner Contest 184 题解 目录 AtCoder Beginner Contest 184 题解 A - Determinant B - Quizzes C - Super Ryuma D - increment of coins E - Third Avenue F - Programming Contest 这把怎么感觉题目都比以往的ABC水啊,拜此所赐我只是程序写得慢就排名狂掉( A - Determinant 求二阶矩阵的行列式,是小学常见自定义题目(…
AtCoder Beginner Contest 169 题解 这场比赛比较简单,证明我没有咕咕咕的时候到了! A - Multiplication 1 没什么好说的,直接读入两个数输出乘积就好了. #include<bits/stdc++.h> using namespace std; int main(){ int a,b; cin>>a>>b; cout<<a*b; return 0; } B - Multiplication 2 让你连乘,同时在答案…
[整除] 若a被b整除,即a是b的倍数,那么记作b|a("|"是整除符号),读作"b整除a"或"a能被b整除".b叫做a的约数(或因数),a叫做b的倍数. [质因数分解] 把一个正整数数分解成几个质数的幂相乘的形式叫做质因数分解. e.g. 10=2*5 16=24 18=2*32 [唯一分解定理] 唯一分解定理(算术基本定理)可表述为:任何一个大于1的自然数 N,如果N不为质数,那么N可以唯一分解成有限个质数的乘积: N=P1a1*P2a2*P…
AtCoder ExaWizards 2019 简要题解 Tags:题解 link:https://atcoder.jp/contests/exawizards2019 很水的一场ARC啊,随随便便就ABCDE了,F最后想到了还没有写出来. D题花了太久时间所以只有Rank31,我是真的菜. 嘿嘿嘿,上述装逼方式是我最为反感的机房里的言语,既然快退役了,也就学一学,感受一下机房里dalao们怎么样装逼一时爽.一直装逼一直爽,听者一时丧,一直听一直丧的快感咯 有意思的题应该是DE了. A Regu…