当前位置:网站首页>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代码:
边栏推荐
- 2022 Niuke multi School II_ E I
- Win11壁纸变黑怎么办?Win11壁纸变黑了的解决方法
- Slam overview Reading Note 4: a survey on deep learning for localization and mapping: towards the age of spatial 2020
- Regular expressions: mailbox matching
- FPGA时序约束分享04_output delay 约束
- Summary of basic knowledge of C language
- 终于有人把面试必考的动态规划、链表、二叉树、字符串全部撸完了
- 解气!哈工大被禁用MATLAB后,国产工业软件霸气回击
- SLAM综述阅读笔记六:基于图像语义的SLAM调研:移动机器人自主导航面向应用的解决方案 2020
- Get the data of the first frame of unity's open camera
猜你喜欢

腾讯二面:@Bean 与 @Component 用在同一个类上,会怎么样?

Understand JS execution context in an article

Tencent two sides: @bean and @component are used in the same class, what will happen?

JS 疫情宅在家,学习不能停,七千字长文助你彻底弄懂原型与原型链

Slam overview Reading Note 7: visual and visual intangible slam: state of the art, classification, and empirical 2021

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

Unity3d learning note 10 - texture array

【STM32】EXTI

Kubernetes 节点磁盘故障排查

Toward fast, flexible, and robust low light image enhancement cvpr2022
随机推荐
Architecture - the sublimation of MVC
DXGI 方式采集流程
uniapp的request数据请求简单封装步骤
PROFINET 模拟器使用教程
How to solve cache avalanche, breakdown and penetration problems
Redis
Getting started for beginners: build your own blog with WordPress
Airport cloud business sign analysis
Slam overview Reading Note 6: slam research based on image semantics: application-oriented solutions for autonomous navigation of mobile robots 2020
自动化配置SSH免密登录和取消SSH免密配置脚本
C语言基础知识梳理总结
Docker实践经验:Docker 上部署 mysql8 主从复制
C language layered understanding (C language array)
如何做好企业系统漏洞评估
idea打jar包与引入jar包
「游戏引擎 浅入浅出」4.1 Unity Shader和OpenGL Shader
Hard deduction SQL statement exercises, wrong question records
Failed to connect to ResourceManager
Stock trading 4
SLAM综述阅读笔记四:A Survey on Deep Learning for Localization and Mapping: Towards the Age of Spatial 2020