当前位置:网站首页>NEFU119 组合素数【算术基本定理】
NEFU119 组合素数【算术基本定理】
2022-07-27 13:49:00 【51CTO】
题目链接:
http://acm.nefu.edu.cn/JudgeOnline/problemshow.php?problem_id=119
题目大意:
给你两个整数N和P,求出C(2*N,N)被素数p整数的次数。
思路:
由算术基本定理的性质(5)可得到N!被素数P整除的次数。
来看这道题,C(2*N,N) = (2*N)! / (N! * N!)。最终结果就是从(2*N)!能被素数P整除的
次数里边减去N!能被素数整除的次数*2。最终结果为:
[2*N/P] + [2*N/P^2] + … + [2*N/P^t] - 2*([N/P] + [N/P^2] + … + [N/P^t])。
其中次数t = logP(2*N),即log10(2*N) / log10(P)。
AC代码:
边栏推荐
- Hdu1422 revisits the world cup [DP]
- SkyWalking分布式系统应用程序性能监控工具-中
- Understand JS execution context in an article
- Interprocess communication
- C语言基础练习题目
- @What happens when bean and @component are used on the same class?
- FPGA时序约束分享04_output delay 约束
- Research on Chinese idiom metaphorical knowledge recognition and relevance based on transfer learning and text enhancement
- codeforces 1708E - DFS Trees
- 一文搞懂 Redis 架构演化之路
猜你喜欢

Research on Chinese idiom metaphorical knowledge recognition and relevance based on transfer learning and text enhancement

自动化配置SSH免密登录和取消SSH免密配置脚本

The interviewer asked: how to judge whether an element is in the visible area?

文献翻译__tvreg v2:用于去噪、反卷积、修复和分割的变分成像方法(部分)
![[ManageEngine] what is Siem](/img/a6/0fbe60df6bef337a91a10fe046aa8a.jpg)
[ManageEngine] what is Siem

Lecture 4: Longest ascending substring

架构——MVC的升华

【STM32】EXTI

telnet远程登录aaa模式详解【华为eNSP】

JS 疫情宅在家,学习不能停,七千字长文助你彻底弄懂原型与原型链
随机推荐
终于有人把面试必考的动态规划、链表、二叉树、字符串全部撸完了
巨形象的图解 SQL
CPU、GPU、NPU的区别
【云享读书会第13期】视频文件的封装格式
2022 Niuke multi School II_ E I
基于GEC6818开发板的相册
@Repository详解
TXT把换行 替换为空格或者取消换行
大家最想要的,最全的C语言知识点总结,还不赶紧学习
Dynamic programming - stock trading 5
arduino+ZE08-CH2O甲醛模块,输出甲醛含量
C语言基础知识梳理总结
log4j2 jdbc appender
codeforces 1708E - DFS Trees
NEFU117 素数个数的位数【素数定理】
Slam overview Reading Note 4: a survey on deep learning for localization and mapping: towards the age of spatial 2020
Secondary spanning tree [template]
@Detailed explanation of repository
SLAM综述阅读笔记七:Visual and Visual-Inertial SLAM: State of the Art, Classification,and Experimental 2021
Graphic SQL of giant image