随笔分类 -  2-数论

摘要:Count Pairs You are given a prime number pp, nn integers a1,a2,…,ana1,a2,…,an, and an integer kk. Find the number of pairs of indexes (i,j)(i,j) (1≤i< 阅读全文
posted @ 2019-07-06 02:22 yzm10 阅读(492) 评论(0) 推荐(0)
摘要:B. 腾讯益智小游戏—矩形面积交(简单) 1000ms 262144K 腾讯游戏开发了一款全新的编程类益智小游戏,最新推出的一个小游戏题目是关于矩形面积交的。聪明的你能解出来吗?看下面的题目接招吧。 给定二维平面上 nn 个与坐标轴平行的矩形,每个矩形是形如 \lbrace (x,y) | x,y 阅读全文
posted @ 2019-06-02 18:01 yzm10 阅读(362) 评论(0) 推荐(0)
摘要:阿里巴巴协助征战SARS(困难) 33.29% 1000ms 262144K 目前,SARS 病毒的研究在世界范围内进行,经科学家研究发现,该病毒及其变种的 DNA 的一条单链中,胞嘧啶、腺嘧啶均是成对出现的。这虽然是一个重大发现,但还不是该病毒的最主要特征,因为这个特征实在太弱了。 为了进一步搞清 阅读全文
posted @ 2019-06-02 17:41 yzm10 阅读(303) 评论(0) 推荐(0)
摘要:A-【六】平面 链接:https://ac.nowcoder.com/acm/contest/907/A?&headNav=acm来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536K 64bit IO Format: %lld 时间限制:C 阅读全文
posted @ 2019-05-31 20:39 yzm10 阅读(281) 评论(0) 推荐(0)
摘要:many sum 链接:https://ac.nowcoder.com/acm/contest/879/G来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 524288K,其他语言1048576K 64bit IO Format: %lld 时间限制:C/C++ 1秒,其 阅读全文
posted @ 2019-05-11 22:48 yzm10 阅读(260) 评论(0) 推荐(0)
摘要:P3382 【模板】三分法 题目描述 如题,给出一个N次函数,保证在范围[l,r]内存在一点x,使得[l,x]上单调增,[x,r]上单调减。试求出x的值。 输入输出格式 输入格式: 第一行一次包含一个正整数N和两个实数l、r,含义如题目描述所示。 第二行包含N+1个实数,从高到低依次表示该N次函数各 阅读全文
posted @ 2018-10-03 20:04 yzm10 阅读(797) 评论(0) 推荐(0)
摘要:Recursive sequence Farmer John likes to play mathematics games with his N cows. Recently, they are attracted by recursive sequences. In each turn, the 阅读全文
posted @ 2018-09-23 16:52 yzm10 阅读(238) 评论(0) 推荐(0)
摘要:Find a path Frog fell into a maze. This maze is a rectangle containing NN rows and MM columns. Each grid in this maze contains a number, which is call 阅读全文
posted @ 2018-08-27 21:56 yzm10 阅读(186) 评论(0) 推荐(0)
摘要:Do you know what is called ``Coprime Sequence''? That is a sequence consists of nnpositive integers, and the GCD (Greatest Common Divisor) of them is 阅读全文
posted @ 2018-08-24 20:52 yzm10 阅读(114) 评论(0) 推荐(0)
摘要:Harmonic Number In mathematics, the nth harmonic number is the sum of the reciprocals of the first n natural numbers: In this problem, you are given n 阅读全文
posted @ 2018-08-24 20:20 yzm10 阅读(435) 评论(0) 推荐(0)
摘要:Sequence Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1731 Accepted Submission(s): 656 Probl 阅读全文
posted @ 2018-08-14 23:09 yzm10 阅读(305) 评论(0) 推荐(0)
摘要:I Count Two Three 31.1% 1000ms 32768K I will show you the most popular board game in the Shanghai Ingress Resistance Team. It all started several mont 阅读全文
posted @ 2018-08-14 19:59 yzm10 阅读(204) 评论(0) 推荐(0)
摘要:gpa 链接:https://www.nowcoder.com/acm/contest/143/A来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K Special Judge, 64bit IO Format: %lld 时间限制: 阅读全文
posted @ 2018-08-02 18:23 yzm10 阅读(235) 评论(0) 推荐(0)
摘要:Covering Covering Bob's school has a big playground, boys and girls always play games here after school. To protect boys and girls from getting hurt w 阅读全文
posted @ 2018-07-15 16:22 yzm10 阅读(447) 评论(0) 推荐(1)
摘要:Permutation Counting Given a permutation a1, a2, … aN of {1, 2, …, N}, we define its E-value as the amount of elements where ai > i. For example, the 阅读全文
posted @ 2018-04-12 16:52 yzm10 阅读(330) 评论(0) 推荐(0)
摘要:组合数学推推推最后,推得要求C(n+m,m)%p 其中n,m小于10^9,p小于1^5 用Lucas定理求(Lucas定理求nm较大时的组合数) 因为p数据较小可以直接阶乘打表求逆元 求逆元时,由费马小定理知道p为素数时,a^p-1=1modp可以写成a*a^p-2=1modp 所以a的逆元就是a^ 阅读全文
posted @ 2018-04-09 21:47 yzm10 阅读(282) 评论(0) 推荐(0)
摘要:Sum Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 3980 Accepted Submission(s): 1620 Problem D 阅读全文
posted @ 2018-04-08 22:52 yzm10 阅读(388) 评论(0) 推荐(0)
摘要:A Trivial Problem Mr. Santa asks all the great programmers of the world to solve a trivial problem. He gives them an integer m and asks for the number 阅读全文
posted @ 2018-04-05 21:55 yzm10 阅读(267) 评论(0) 推荐(0)
摘要:一,加法原理与乘法原理 加法原理与乘法原理是排列与组合的基础。加法原理本质上是分类,乘法原理本质上是分步。 分类,就是把一个集合(某事物)分成互不相交的若干独立的部分。比如,概率论中的全概率公式就将事件分成”全划分“ 分类思想可以简化程序的时间复杂度。比如:最短路径算法-Dijkstra算法的应用之 阅读全文
posted @ 2018-03-10 17:10 yzm10 阅读(667) 评论(0) 推荐(0)
摘要:一、什么是Catalan数 说到Catalan数,就不得不提及Catalan序列,Catalan序列是一个整数序列,其通项公式是 递推公式是 C(n) = C(1)*C(n-1) + C(2)*C(n-2) + ... + C(n-1)C(1),n>=2 我们从中取出的就叫做第n个Catalan数, 阅读全文
posted @ 2018-03-10 16:51 yzm10 阅读(526) 评论(0) 推荐(0)