上一页 1 ··· 67 68 69 70 71 72 73 74 75 ··· 171 下一页
摘要: 整数除法向上取整 方法一 在$c++$上,默认的除法是整数除法向下取整,那有些场景中我们需要整数除法向上取整,办法是什么呢?(这里不说证明的办法,直接给结论) $\huge \lceil \frac{n}{m} \rceil = \lfloor \frac{n-1}{m} \rfloor +1 \ 阅读全文
posted @ 2021-09-01 10:07 糖豆爸爸 阅读(1900) 评论(0) 推荐(1)
摘要: 一、单个数质因数分解 直接上代码: #include <bits/stdc++.h> using namespace std; /** * 功能:分解质数因数 * @param a 待分解的数字 */ const int N = 1010; int primes[N]; //质数因子数组 int i 阅读全文
posted @ 2021-09-01 08:31 糖豆爸爸 阅读(307) 评论(0) 推荐(0)
摘要: 题目传送门 #include <bits/stdc++.h> using namespace std; typedef long long LL; LL x, y, ans; //辗转相除法 LL gcd(LL a, LL b) { if (b == 0) return a; ans += 4 * 阅读全文
posted @ 2021-08-31 16:37 糖豆爸爸 阅读(41) 评论(0) 推荐(0)
摘要: 题目传送门 一、解题思路 这道题有些意思,因为$a$肯定是分子,怎么想办法也不可能变成分母。$b$肯定是分母,怎么的也变不成分子。$c,d,e,f...$就是有可能是分子,也有可能是分母,尽量想办法让它们全是分子,这样出现整数的概率高,出现在分母,还得想办法去约分掉它,麻烦。(贪心) 那它们是否真的 阅读全文
posted @ 2021-08-31 16:15 糖豆爸爸 阅读(116) 评论(0) 推荐(0)
摘要: 题目传送门 一、准备知识 求一个数x的所有约数 #include <bits/stdc++.h> using namespace std; const int N = 1010; int c[N]; /** * 功能:获取指定数x的所有约数 * @param x */ void ys(int x) 阅读全文
posted @ 2021-08-31 14:34 糖豆爸爸 阅读(76) 评论(0) 推荐(0)
摘要: 题目传送门 #include <bits/stdc++.h> using namespace std; typedef long long LL; LL a, b, c; LL gcd(LL x, LL y) { return y ? gcd(y, x % y) : x; } LL lcm(LL x 阅读全文
posted @ 2021-08-31 10:53 糖豆爸爸 阅读(47) 评论(0) 推荐(0)
摘要: 题目传送门 #include <bits/stdc++.h> using namespace std; int a, b, c, d; /** 测试用例: 2/1+1/3-1/4 答案:25/12 -2/1+1/3-1/4 答案:-23/12 测试点6 7/4+1/3+8/5-3/2-6/9-6/4 阅读全文
posted @ 2021-08-31 10:47 糖豆爸爸 阅读(95) 评论(0) 推荐(0)
摘要: 一、预备知识 整数除法向上取整 二、题意分析 细胞分裂到一定的数量,可以“平均分布”到各个试管中。 这句话的意思就是说:细胞数量能整除试管的数量,并且是最少的分裂步数。 试管的数量$M=m_1^{m_2}$,其中$m_1<=3000,m_2<=1000$,这玩意太大了,不可能直接算!既然不能直接算, 阅读全文
posted @ 2021-08-31 08:05 糖豆爸爸 阅读(700) 评论(0) 推荐(0)
摘要: 一、定理内容 算术基本定理,又名唯一分解定理。若$a>1$,那么必有$a=p_1 ^ {\alpha _1}p_2^{\alpha _2}...p_s^{\alpha _s}$,其中$p_j(1<=j<=s)$是两两不相同的质数,$a_j(1<=j<=s)$表示对应质数的幂次(出现的次数)。若在不计 阅读全文
posted @ 2021-08-30 13:50 糖豆爸爸 阅读(924) 评论(0) 推荐(1)
摘要: \(AcWing\) \(200\). \(Hankson\)的趣味题 和 这道题 是姊妹题关系,套路应该是一样的,无脑的写代码: 一、题目描述 \(Hanks\) 博士是 \(BT\)(\(Bio-Tech\),生物技术)领域的知名专家,他的儿子名叫 \(Hankson\)。 现在,刚刚放学回家的 阅读全文
posted @ 2021-08-30 09:13 糖豆爸爸 阅读(302) 评论(0) 推荐(0)
上一页 1 ··· 67 68 69 70 71 72 73 74 75 ··· 171 下一页
Live2D