![](https://img-blog.csdnimg.cn/20190918140158853.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
算法题库
文章平均质量分 54
一些算法题目的题解
小陌白
爱对象(葡萄),爱生活,爱代码
展开
-
Codeforces Round #697 (Div. 3) A. Odd Divisor
A. Odd DivisorYou are given an integer n. Check if n has an odd divisor, greater than one (does there exist such a number x (x>1) that n is divisible by x and x is odd).For example, if n=6, then there is x=3. If n=4, then such a number does not exist.原创 2021-01-28 19:46:14 · 151 阅读 · 0 评论 -
Codeforces Round #697 (Div. 3) B. New Year‘s Number
B. New Year's NumberPolycarp remembered the 2020-th year, and he is happy with the arrival of the new 2021-th year. To remember such a wonderful moment, Polycarp wants to represent the number n as the sum of a certain number of 2020 and a certain number o原创 2021-01-28 20:14:19 · 207 阅读 · 0 评论 -
Codeforces Round #697 (Div. 3) C. Ball in Berland
C. Ball in BerlandAt the school where Vasya is studying, preparations are underway for the graduation ceremony. One of the planned performances is a ball, which will be attended by pairs of boys and girls.Each class must present two couples to the ball.原创 2021-01-28 20:51:33 · 312 阅读 · 0 评论 -
Codeforces Round #697 (Div. 3) D. Cleaning the Phone
D. Cleaning the PhonePolycarp often uses his smartphone. He has already installed n applications on it. Application with number i takes up ai units of memory.Polycarp wants to free at least m units of memory (by removing some applications).Of course,原创 2021-01-28 21:32:52 · 256 阅读 · 0 评论 -
计蒜客 T1866 组合的输出
排列与组合是常用的数学方法,其中组合就是从 n 个元素中抽出 r个元素原创 2021-01-28 21:52:51 · 131 阅读 · 0 评论 -
洛谷P1331海战
题目描述在峰会期间,武装部队得处于高度戒备。警察将监视每一条大街,军队将保卫建筑物,领空将布满了F-2003飞机。此外,巡洋船只和舰队将被派去保护海岸线。不幸的是因为种种原因,国防海军部仅有很少的几位军官能指挥大型海战。因此,他们考虑培养一些新的海军指挥官,他们选择了“海战”游戏来帮助学习。在这个著名的游戏中,在一个方形的盘上放置了固定数量和形状的船只,每只船却不能碰到其它的船。在这个题中,我们仅考虑船是方形的,所有的船只都是由图形组成的方形。编写程序求出该棋盘上放置的船只的总数。原创 2021-02-03 15:24:01 · 501 阅读 · 0 评论 -
L2-018 多项式A除以B (25 分)
利用数组模拟多项式相除的过程解题原创 2022-04-11 13:50:00 · 431 阅读 · 0 评论 -
快速幂+矩阵快速幂
利用快速幂的方法计算较大的求幂运算原创 2020-08-25 13:05:17 · 228 阅读 · 0 评论 -
乘法逆元的三种求解方法
目录乘法逆元小结逆元的定义求解逆元的方法1. 快速幂测试代码2.乘法逆元小结乘法逆元,一般用于求(a / b)(modp)的值(p 通常为质数),是解决模意义下分数数值的必要手段。关于求余,有以下三种规则:加法:(a+b)%m=(a%m+b%m)%m(a+b)%m=(a%m+b%m)%m减法:(a−b)%m=(a%m−b%m)%m(a−b)%m=(a%m−b%m)%m乘法:(a∗b)%m=(a%m∗b%m)%m(a∗b)%m=(a%m∗b%m)%m但是这个规则在除法不适用,所以就要用到乘法逆原创 2020-09-02 15:15:24 · 6254 阅读 · 2 评论 -
OJ常见错误类型
OJ常见错误类型1.PE2.TLE3.MLE4.WA5.RE6.OLE7.CEAC原创 2021-03-03 07:47:44 · 3690 阅读 · 0 评论 -
快速幂
用C++实现快速算底数a的b次幂,其时间复杂度为 O(log₂b)。原创 2021-05-01 01:08:49 · 118 阅读 · 1 评论 -
C++最大k乘积问题(动态规划)
利用动态规划求解最大k乘积问题原创 2021-05-13 15:11:26 · 730 阅读 · 3 评论 -
C++租用游艇问题(动态规划)
利用动态规划思想求解租用游艇问题原创 2021-05-13 14:37:04 · 971 阅读 · 0 评论 -
C++字符串比较问题(动态规划)
利用动态规划的思想求解字符串比较问题原创 2021-05-06 12:04:25 · 1026 阅读 · 0 评论 -
C++数字三角形(简单动态规划问题)
利用动态规划思想求解数字三角形问题原创 2021-05-06 11:04:23 · 1778 阅读 · 1 评论 -
计蒜客T1375——百钱买百鸡(四)
做过百钱买百鸡,那么你肯定要试一试n钱买n只鸡了,不过在n为10^18这么如此大的数的时候,该怎么做呢?快来看看吧!转载 2020-08-31 09:57:04 · 629 阅读 · 1 评论