![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数论
Dust_Heart
这个作者很懒,什么都没留下…
展开
-
HDOJ 4135 Co-prime(容斥原理)
Co-primeTime Limit: 2000/1000 MS(Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4645 Accepted Submission(s): 1854Problem DescriptionGiven a number N, you原创 2017-04-19 20:17:23 · 290 阅读 · 0 评论 -
组合数学之放球问题 【附斯特林数】
组合数学之放球问题放球问题在组合数学中是一个经典问题,在ACM比赛中也经常会出现类似的题目,这里做一个归纳。我们假定现在有n个球,要放到m个盒子中,根据情况的不同主要可以分为一下8类(这里确保n>=m)一、 球相同,盒相同,允许空盒 二、 球相同,盒相同,不允许空盒三、 球相同,盒不相同,不允许空盒 四、 球相同,盒不相同,允许空盒五、 球不相同,盒相同,不允许空盒 六、 球不相同,盒相同,允许空盒六、 球不相同,盒相同,允许空盒 八、 球不相同,盒不原创 2017-08-19 21:08:23 · 2587 阅读 · 0 评论 -
Codeforces 851D - Arpa and a list of numbers 【素数+前缀和】
Codeforces 851D - Arpa and a list of numbers 【素数+前缀和】 Arpa has found alist containing n numbers. Hecalls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1.Arpa can performtwo types of原创 2017-09-05 13:22:14 · 1188 阅读 · 0 评论 -
HDU 6237/2017CCPC哈尔滨 A Simple Stone Game【质因子】
HDU 6237/2017CCPC哈尔滨 A Simple Stone Game【质因子】After he has learned how toplay Nim game, Bob begins to try another stone game which seems much easier.The game goes like this: one player starts the game with N piles of stones. There is ai stoneson the i th原创 2017-11-12 23:46:57 · 2103 阅读 · 0 评论 -
Codeforces 893E - Counting Arrays 【组合数】
Codeforces 893E - Counting Arrays 【组合数】 You are given two positive integer numbers x and y. An array F is called an y-factorization of x iff the following conditions are met:· There are y elements in F, and all of them are integer numbers; · . You原创 2017-11-24 15:00:09 · 1004 阅读 · 0 评论 -
Codeforces 919E - Congruence Equation【数论-欧拉降幂】
E. Congruence Equation time limit per test 3 seconds memory limit per test 256 megabytesGiven an integer x. Your task is to find out how many positive integers n (1 ≤ n ≤ x) satisfy n∗原创 2018-02-06 18:15:50 · 447 阅读 · 0 评论 -
Codeforces 920G - List Of Integers 【容斥+二分】
Codeforces 920G - List Of Integers 【容斥+二分】Let's denote as L(x, p) an infinitesequence of integers y such that gcd(p, y) = 1 and y > x (where gcd is the greatestcommon divisor of two integer numbers), sorted in ascending order. The elementsof L(x, p) are 1原创 2018-02-06 13:40:30 · 489 阅读 · 0 评论 -
Codeforces 914C - Travelling Salesman and Special Numbers 【思维】
Codeforces 914C - Travelling Salesman and Special Numbers 【思维】Codecraft-18 and Codeforces Round #458 (Div. 1 + Div. 2, combined)memory limit per test 256 megabytesThe Travelling Salesman spends a lot of time travelling so he tends to get bored. To原创 2018-03-16 16:13:50 · 787 阅读 · 0 评论 -
反素数求解及相关题目
反素数定义:对于任何正整数n,其约数个数记为f(n),例如f(6)=4;如果存在一个正整数n满足:对于任意的正整数x(0<x<n),都有f(x)<f(n)成立,那么把n称为反素数。一个反素数的所有质因子必然是从2开始的若干个质数,因为一个数是反素数,说明在跟它约数相同的数中,它是最小的。如果n=2t1 * 3t2 * 5t3 *...,那么一定有t1>=t2>=t3&...原创 2017-05-26 18:27:48 · 3316 阅读 · 1 评论 -
Wannafly挑战赛9 造一造||2018年长沙理工大学程序设计竞赛 杯子 【卡特兰数】
题目描述WYF正试图用一个栈来构造一棵树,现在他已经构造了n个元素作为树的节点,只要将这n个元素依次入栈出栈就可以形成一棵树了。当然,这个问题与树并没有关系,所以它叫做WYF的栈。每次你可以入栈一个新元素或者当栈非空时出栈一个元素,n个元素必须依次入栈,而WYF希望其中第m个元素入栈之后,栈中恰好有k个元素,现在他想知道一共有多少种入栈出栈顺序满足这个条件。输入描述:第一行一个正整数T,表示数据组...原创 2018-04-25 14:16:48 · 537 阅读 · 0 评论 -
The 15th ZPCPC ||ZOJ Problem Set - 4029 Now Loading!!!【数论】
Now Loading!!!Time Limit: 2000/1000 MS(Java/Others) Memory Limit: 262144/131072 K (Java/Others)Problem DescriptionDreamGrid has n integers a1,a2,a3...an. DreamGrid also has m queries, and each time...原创 2018-05-04 13:46:49 · 553 阅读 · 0 评论 -
2018 Multi-University Training Contest 7 HDU6390 GuGuFishtion【数论欧拉函数|gcd|莫比乌斯】
GuGuFishtion Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Problem DescriptionToday XianYu is too busy with his homework, but the boring GuGu is still distu...原创 2018-08-13 18:59:10 · 1072 阅读 · 2 评论 -
2017 Multi-University Training Contest 4 && HDOJ 6069 Counting Divisors 【区间筛法】
2017 Multi-University Training Contest 2 && HDOJ 6069 Counting Divisors 【区间筛法】In mathematics, the function d(n)denotes the number of divisors of positive integer n.For example, d(12)=6because 1,2,3,4,6,12are all 12's divisors.In this problem原创 2017-08-03 20:29:22 · 408 阅读 · 0 评论 -
2017 Multi-University Training Contest 2 && HDOJ 6053 TrickGCD 【容斥+莫比乌斯函数】
2017 Multi-University Training Contest 2 && HDOJ 6053 TrickGCD 【容斥+莫比乌斯函数】You are given an array A, and Zhu wants to know there are how many different array Bsatisfy the following conditions?* 1≤Bi≤Ai* For each pair( l , r ) (1≤l≤r≤n) , g原创 2017-07-27 23:27:30 · 456 阅读 · 0 评论 -
HDOJ 2588 GCD 【欧拉函数】 附数据加强版 【Miller_Rabin+Pollard_Rho算法】
HDOJ 2588 GCD 【欧拉函数】 附数据加强版 【Miller_Rabin+Pollard_Rho算法】The greatest common divisor GCD(a,b) of two positive integers a and b,sometimes written (a,b),is the largest divisor common to a and b,Forexample,(1,2)=1,(12,18)=6.(a,b) can be easily found by the E原创 2017-08-08 23:11:44 · 467 阅读 · 0 评论 -
HDOJ 2841 Visible Trees (容斥原理)
Visible TreesTime Limit: 2000/1000 MS(Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3068 Accepted Submission(s): 1355Problem DescriptionThere are many tr原创 2017-04-19 23:09:44 · 273 阅读 · 0 评论 -
HDOJ 2054 A == B ?(大数)
A == B ?Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 98202 Accepted Submission(s): 15578Problem DescriptionGive you two numb原创 2016-12-20 20:24:54 · 409 阅读 · 0 评论 -
HDOJ 1796 How many integers can you find(容斥原理)
How manyintegers can you findTime Limit: 12000/5000 MS(Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7928 Accepted Submission(s): 2361Problem Description原创 2017-04-24 00:52:13 · 269 阅读 · 0 评论 -
ZJCOJ L先生与质数V3/V4 (Meisell-Lehmer算法)
Problem L: L先生与质数V4(应各位菊苣要求)Time Limit:1 Sec Memory Limit:16 MBSubmit:298 Solved:65[Submit][Status][WebBoard]Description在解决了上一个质数问题之后,L先生依然不甘心,他还想计算下更多范围内的质数,你能帮助他吗?(没错这题题面和V3一毛一样)原创 2017-05-30 00:53:47 · 1255 阅读 · 0 评论 -
HDOJ 5213 Lucky(分块+莫队+容斥原理)
LuckyTimeLimit: 6000/3000 MS (Java/Others) Memory Limit:65536/65536 K (Java/Others)Total Submission(s): 1114 Accepted Submission(s): 398Problem DescriptionWLD is always very lucky.Hi原创 2017-06-03 17:53:49 · 366 阅读 · 0 评论 -
CF Round #422( Div.1/2) D. My pretty girl Noora
CF Round #422( Div.1/2) D. My pretty girl NooraIn Pavlopolis University where Noora studies it was decided tohold beauty contest "Miss Pavlopolis University". Let's describe theprocess of choosing the most beautiful girl in the university in more detail.原创 2017-07-03 03:11:41 · 526 阅读 · 0 评论 -
2017 CCPC-WFinal&&HDOJ6025 Coprime Sequence(前缀后缀GCD问题)
Do you know what is called``Coprime Sequence''? That is a sequence consists ofn positive integers, and the GCD (Greatest Common Divisor) of them is equal to 1.“Coprime Sequence'' is easy to find because of its restriction. But we can tryto maximize the GC原创 2017-05-07 13:03:16 · 1377 阅读 · 0 评论 -
HDOJ 1695 GCD(容斥+欧拉函数&&莫比乌斯反演+分块)
HDOJ 1695 GCD(容斥+欧拉函数&&莫比乌斯反演)Given 5 integers: a, b, c, d, k, you're to find x in a...b, y in c...d that GCD(x, y)= k. GCD(x, y) means the greatest common divisor of x and y. Since the numberof choices may be very large, you're only required to output th原创 2017-06-28 19:15:52 · 526 阅读 · 0 评论 -
2017"百度之星"程序设计大赛 - 资格赛 &&HDOJ6084 寻找母串 【卡特兰数+分块打表】
HDOJ6084 【卡特兰数+分块打表】对于一个串S,当它同时满足如下条件时,它就是一个01偏串:1、只由0和1两种符组成;2、在S的每一个前缀中,0的个数不超过1的个数;3、S中0的个数和1的个数相等。现在给定01偏串S,请计算一下S在所有长度为n的01偏串中作为子串出现的次数的总和。由于结果比较大,结果对1e9+7取余后输出。样例解释:在第二个样例中,长度为4的偏串共两个1010,1100。10在1010中出现了两次,在1100中出现了1次。所以答案是3。原创 2017-08-07 15:10:55 · 823 阅读 · 0 评论 -
HDOJ 2824 The Euler function (欧拉函数)
HDOJ 2824 The Euler function (欧拉函数)The Euler function phi is animportant kind of function in number theory, (n) represents the amount of thenumbers which are smaller than n and coprime to n, and this function has a lotof beautiful characteristics. Here co原创 2017-04-19 19:28:21 · 720 阅读 · 0 评论 -
2018 Multi-University Training Contest 8 &&HDU6397 Character Encoding【数论-组合数学|容斥】
Character Encoding Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Problem DescriptionIn computer science, a character is a letter, a digit, a punctuation mar...原创 2018-08-16 14:14:50 · 291 阅读 · 0 评论