随笔分类 -  数学

摘要:题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=6287 Summarize: 1、分解质因数; 2、二分查找函数lower_bound与upper_bound; 3、注意输入输出超时与初始化; 阅读全文
posted @ 2019-05-28 21:13 liubilan 阅读(288) 评论(0) 推荐(2) 编辑
摘要:题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=6288 Summarize:1、二分查找答案; 2、自带log函数精度不够,需自己写; 3、注意二分递归的左右区间; 4、计算中可能爆LL,故需尽可能做一步就判断一次; 阅读全文
posted @ 2019-05-27 21:28 liubilan 阅读(267) 评论(0) 推荐(0) 编辑
摘要:题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=6446 题目给出的数据为一棵树,dfs扫描每条边,假设去掉某条边,则左边 x 个点,右边 n-x 个点,则经过该条边共有 x*(n-x) 种组合,又因为 1~n 全排列有 n! 种,故 a~b,包含 b~ 阅读全文
posted @ 2018-08-28 16:05 liubilan 阅读(175) 评论(0) 推荐(0) 编辑
摘要:题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=6440 这题主要是理解题意; 题意:定义一个加法和乘法,使得 (m+n)p = mp+np; 其中给定 p 为素数,m,n 为小于p的数; 费马小定理:am-1 ≡ 1(mod p); 故有 am ≡ a 阅读全文
posted @ 2018-08-27 11:11 liubilan 阅读(216) 评论(0) 推荐(0) 编辑
摘要:题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=6441 Knowledge Point: 1. 费马大定理:当整数n >2时,关于x, y, z的方程 x^n + y^n = z^n 没有正整数解。 2. 0^0次没有意义!! 所以我们知道 n=0, 阅读全文
posted @ 2018-08-26 16:46 liubilan 阅读(335) 评论(0) 推荐(0) 编辑
摘要:题目地址:https://www.nowcoder.com/acm/contest/158/A 参考博客:https://blog.csdn.net/zzcblogs/article/details/78816533 1~n 约数的个数的和实际就是看 1~n 在这些数中出现过多少次,例如 1是1~n 阅读全文
posted @ 2018-08-24 20:39 liubilan 阅读(398) 评论(0) 推荐(0) 编辑
摘要:题目地址:https://www.nowcoder.com/acm/contest/136/J 解法一: 推数学公式求前n项和; 当k=1时,即为等差数列,Sn = n+pn(n−1)/2 当k≠1时,an+p/(k−1) = k(an−1+p/(k-1)),等比数列,Sn = (kn+1+(p−1 阅读全文
posted @ 2018-08-22 20:03 liubilan 阅读(176) 评论(0) 推荐(0) 编辑
摘要:题目地址:http://www.51cpc.com/web/problem.php?id=4286 解法 1: 解法 2:机智的解法 解法 3:这个简直超神了。。看到这个瞬间就清醒了,就是求4的多少次,特判下0的情况就行; 阅读全文
posted @ 2018-08-21 11:30 liubilan 阅读(179) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示