
数论
文章平均质量分 57
junior19
abcde
展开
-
ZJCOJ: L先生与质数V4(数论)
Problem L: L先生与质数V4(应各位菊苣要求)Time Limit: 1 Sec Memory Limit: 16 MBSubmit: 313 Solved: 71[Submit][Status][Web Board]Description在解决了上一个质数问题之后,L先生依然不甘心,他还想计算下更多范围内的质数,你能帮助他吗?(没错这题题面和V3一毛原创 2017-05-29 21:21:32 · 1679 阅读 · 0 评论 -
CF830C:Bamboo Partition(数学)
C. Bamboo Partitiontime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputVladimir wants to modernize partitions原创 2017-07-23 23:11:28 · 477 阅读 · 0 评论 -
CF306C:White, Black and White Again(组合数)
C. White, Black and White Againtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarpus is sure that his原创 2017-08-18 13:12:19 · 350 阅读 · 0 评论 -
CF111D:Petya and Coloring(组合数)
D. Petya and Coloringtime limit per test5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle Petya loves counting. He wants原创 2017-08-18 17:11:09 · 377 阅读 · 0 评论 -
CodeChef:Chef Anup(数学)
Chef Anup Problem Code: CHEFANUPSubmitTweet All submissions for this problem are available.Read problems statements in Mandarin Chinese and Russian.原创 2017-08-18 21:33:53 · 598 阅读 · 0 评论 -
CF457A:Golden System(数论 & 进制)
A. Golden Systemtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPiegirl got bored with binary, decimal and原创 2017-08-13 22:33:41 · 330 阅读 · 0 评论 -
CF692D2:The Wall (medium)(组合数)
D2. The Wall (medium)time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputHeidi the Cow is aghast: cracks in th原创 2017-08-23 20:40:15 · 2050 阅读 · 0 评论 -
CF689E:Mike and Geometry Problem(组合数)
E. Mike and Geometry Problemtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMike wants to prepare for IMO原创 2017-08-23 22:22:16 · 368 阅读 · 0 评论 -
CodeChef:Fombinatorial(数论 & 逆元)
You are given a function f which is defined as :Your task is to find the value of f(N) / ( f(r)*f(N-r) ). As it will be a large number output it modulo M.InputFirst line cont原创 2017-09-05 22:43:16 · 323 阅读 · 0 评论 -
CodeChef:Devasena(数论)
All submissions for this problem are available.Devasena was the princess of an unknown kingdom (we'll all know which one, in Baahubali 2 ;) ), and her father arranged for a Swayamvara to get her m原创 2017-09-15 13:54:42 · 476 阅读 · 0 评论 -
HDU3359:Kind of a Blur(高斯消元 & 浮点数)
Image blurring occurs when the object being captured is out of the camera's focus. The top two figures on the right are an example of an image and its blurred version. Restoring the original image giv原创 2017-10-01 22:52:00 · 314 阅读 · 0 评论 -
CF632D:Longest Subsequence(思维 & 数论)
D. Longest Subsequencetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given array a with n element原创 2017-08-08 00:03:12 · 532 阅读 · 0 评论 -
CF551D:GukiZ and Binary Operations(矩阵 & 思维)
D. GukiZ and Binary Operationstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputWe all know that GukiZ often原创 2017-08-07 23:09:11 · 371 阅读 · 0 评论 -
ZJCOJ:qwb与神奇的序列(数论)
Problem D: qwb与神奇的序列Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 863 Solved: 94[Submit][Status][Web Board]Descriptionqwb又遇到了一道题目:有一个序列,初始时只有两个数x和y,之后每次操作时,在原序列的任意两个相邻数之间插入这两个数原创 2017-06-01 23:25:34 · 453 阅读 · 0 评论 -
ZJCOJ:勤劳的ACgirls(数学)
Problem C: 勤劳的ACgirlsTime Limit: 1 Sec Memory Limit: 128 MBSubmit: 78 Solved: 27[Submit][Status][Web Board]Descriptionzjc的ACgirls队的队员最近比较忙,为了能够取得更好的比赛成绩,他们制定了一个m天a掉n题的计划,a掉一题可以是这m天的任原创 2017-06-02 16:49:55 · 334 阅读 · 0 评论 -
51NOD1433:0和5(数论)
1433 0和5题目来源: CodeForces基准时间限制:1 秒 空间限制:131072 KB 分值: 10 难度:2级算法题小K手中有n张牌,每张牌上有一个一位数的数,这个字数不是0就是5。小K从这些牌在抽出任意张(不能抽0张),排成一行这样就组成了一个数。使得这个数尽可能大,而且可以被90整除。注意:1.这个数没有前导0,原创 2017-06-10 15:39:48 · 358 阅读 · 1 评论 -
CF815B:Karen and Test(数学)
B. Karen and Testtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputKaren has just arrived at school, and she原创 2017-06-25 15:27:33 · 783 阅读 · 0 评论 -
斐波拉契数列矩阵连乘(模板)
题意:求第N项取模1e9+7。思路:# include using namespace std;typedef long long LL;const LL mod = 1e9+7;struct Mat{LL mat[2][2];};Mat operator *(Mat a, Mat b)//矩阵相乘。{ Mat c; for(int i=0; i<2;原创 2017-07-15 13:17:19 · 325 阅读 · 0 评论 -
CSUST:超级快速幂(费马小定理)
超级快速幂Time Limit: 3000/1000 MS(Java/Others) Memory Limit:65536/65536 K (Java/Others)Description 请计算: a^(b^c)mod(1e9+7)Input 多组数据,第一行为一个整数T,原创 2017-07-17 17:30:32 · 673 阅读 · 0 评论 -
CF822D:My pretty girl Noora(数论)
D. My pretty girl Nooratime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn Pavlopolis University where No原创 2017-07-07 23:21:57 · 640 阅读 · 0 评论 -
AtCoder:11(数论 & 思维)
D - 11Time limit : 2sec / Memory limit : 256MBScore : 600 pointsProblem StatementYou are given an integer sequence of length n+1, a1,a2,…,an+1, which consists of the n integers 1原创 2017-07-08 14:35:27 · 563 阅读 · 0 评论 -
HDU4704:Sum(费马小定理 & 隔板法)
SumTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 2767 Accepted Submission(s): 1155Problem Description Sample原创 2017-07-17 20:31:54 · 288 阅读 · 0 评论 -
CF303B:Rectangle Puzzle II(数学)
B. Rectangle Puzzle IItime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a rectangle grid. That原创 2017-08-07 20:50:57 · 399 阅读 · 0 评论 -
POJ1681:Painter's Problem(高斯消元 & 格子转换 & 二进制)
Painter's ProblemTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 7113 Accepted: 3388DescriptionThere is a square wall which is made of n*n small squar原创 2017-10-01 00:38:38 · 316 阅读 · 0 评论 -
POJ2947:Widget Factory(高斯消元,解模线性方程)
Widget FactoryTime Limit: 7000MS Memory Limit: 65536KTotal Submissions: 6319 Accepted: 2235DescriptionThe widget factory produces several different kinds of wid原创 2017-10-01 23:41:12 · 287 阅读 · 0 评论 -
CF869C:C. The Intriguing Obsession(组合数)
C. The Intriguing Obsessiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output— This is not playing but duty a原创 2017-10-10 21:29:13 · 263 阅读 · 0 评论 -
51nod1806:wangyurzee的树(生成树计数 & 容斥)
1806 wangyurzee的树 基准时间限制:1 秒 空间限制:131072 KB 分值: 80 难度:5级算法题 收藏 关注wangyurzee有n个各不相同的节点,编号从1到n。wangyurzee想在它们之间连n-1条边,从而使它们成为一棵树。可是wangyurzee发现方案数太多了,于是他又给出了m个限制条件,其中第i个限制条件限制了编号为u[i]的节点的度数不能为d[i]。一个节点的...原创 2018-04-04 13:10:58 · 282 阅读 · 0 评论 -
HDU6287:口算训练(莫队算法)
小Q非常喜欢数学,但是他的口算能力非常弱。因此他找到了小T,给了小T一个长度为nn的正整数序列a1,a2,...,ana1,a2,...,an,要求小T抛出mm个问题以训练他的口算能力。 每个问题给出三个正整数l,r,dl,r,d,小Q需要通过口算快速判断al×al+1×...×ar−1×aral×al+1×...×ar−1×ar是不是dd的倍数。 小Q迅速地回答了出来,但是小T并不知道正确答案是...原创 2018-06-01 10:10:39 · 1002 阅读 · 0 评论 -
SDOI2010:古代猪文(Lucas定理 + CRT合并)
题目描述猪王国的文明源远流长,博大精深。iPig在大肥猪学校图书馆中查阅资料,得知远古时期猪文文字总个数为N。当然,一种语言如果字数很多,字典也相应会很大。当时的猪王国国王考虑到如果修一本字典,规模有可能远远超过康熙字典,花费的猪力、物力将难以估量。故考虑再三没有进行这一项劳猪伤财之举。当然,猪王国的文字后来随着历史变迁逐渐进行了简化,去掉了一些不常用的字。iPig打算研究古时某...原创 2018-07-16 16:01:19 · 384 阅读 · 0 评论 -
SCOI2010:生成字符串(组合数 + 思维)
题目描述lxhgww最近接到了一个生成字符串的任务,任务需要他把n个1和m个0组成字符串,但是任务还要求在组成的字符串中,在任意的前k个字符中,1的个数不能少于0的个数。现在lxhgww想要知道满足要求的字符串共有多少个,聪明的程序员们,你们能帮助他吗?输入输出格式输入格式:输入数据是一行,包括2个数字n和m输出格式:输出数据是一行,包括1个数字,表示满足要求的字符串数目,这个数可能会很大,只需输...原创 2018-07-14 22:54:53 · 369 阅读 · 0 评论 -
HDU6390:GuGuFishtion(数学)
GuGuFishtionTime Limit: 3000/1500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 112 Accepted Submission(s): 38 Problem DescriptionToday XianYu is too bus...原创 2018-08-13 19:11:32 · 394 阅读 · 0 评论 -
HDU6395:Sequence(矩阵快速幂)
Let us define a sequence as below ⎧⎩⎨⎪⎪⎪⎪⎪⎪F1F2Fn===ABC⋅Fn−2+D⋅Fn−1+⌊Pn⌋{F1=AF2=BFn=C⋅Fn−2+D⋅Fn−1+⌊Pn⌋ Your job is simple, for each task, you should output FnFn module 109+7109+7. InputThe f...原创 2018-08-13 19:20:26 · 274 阅读 · 0 评论 -
洛谷:多少个1?(BSGS)
题目描述给定整数KK和质数mm,求最小的正整数NN,使得 11\cdots111⋯1(N个1) \equiv K \pmod m≡K(modm)说人话:就是 111...1111 mod m =K输入输出格式输入格式: 第一行两个整数,分别表示KK和mm 输出格式: 一个整数,表示符合条件最小的NN 输入输出样例输入样例#1: 复制9 17...原创 2018-09-26 23:56:11 · 421 阅读 · 0 评论 -
SPOJ:Counting Divisors (general)(min_25筛)
Let \sigma_0(n)σ0(n) be the number of positive divisors of nn.For example, \sigma_0(1) = 1σ0(1)=1, \sigma_0(2) = 2σ0(2)=2 and \sigma_0(6) = 4σ0(6)=4.LetS_k(n) = \sum _{i=1}^n \sigma_0(...原创 2018-10-08 23:08:18 · 274 阅读 · 0 评论 -
ZOJ4011:Happy Sequence(递推 & 质因子)
题目链接题意:给N,M要求构造一个长为M的数组A,每个数不大于N,且A[i]是A[i+1]的因子。思路:枚举第M个数的值,显然每个质因子可以独立讨论,只需要用每个质因子的数量计算,最后将每个质因子的答案乘起来就行,先预处理dp[i][j]表示长度为i,第i个数为j的非降序列长度,计算复杂度O(T*N*sqrt(N)),加点优化实际跑得更快。# include <bits/std...原创 2018-10-18 23:42:52 · 275 阅读 · 0 评论 -
洛谷:[ZJOI2014]力(FFT)
点我查看题目题目描述给出n个数qi,给出Fj的定义如下:F_j = \sum_{i<j}\frac{q_i q_j}{(i-j)^2 }-\sum_{i>j}\frac{q_i q_j}{(i-j)^2 }Fj=∑i<j(i−j)2qiqj−∑i>j(i−j)2qiqj令Ei=Fi/qi,求Ei.输入输出格式输入格式: 第一...原创 2018-10-11 00:00:55 · 322 阅读 · 0 评论 -
HDU1573:X问题(中国剩余定理)
求在小于等于N的正整数中有多少个X满足:X mod a[0] = b[0], X mod a[1] = b[1], X mod a[2] = b[2], …, X mod a[i] = b[i], … (0 < a[i] <= 10)。Input输入数据的第一行为一个正整数T,表示有T组测试数据。每组测试数据的第一行为两个正整数N,M (0 < N <= 1000,000,...原创 2018-03-20 21:10:17 · 324 阅读 · 0 评论 -
数论:快速傅里叶变换FFT题集
FFT(Fast Fourier Transformation——快速傅里叶变换)可以用来快速求多项式乘法,相当于系数向量的卷积,通俗点说就是给定a和b数组,然后求c数组:for(int i=0; i<n; ++i) for(int j=0; j<n; ++j) c[i+j] += a[i]*b[j];FFT就是用来快速求出上述的c数组,FFT分成如下两个过...原创 2018-02-22 15:32:36 · 1714 阅读 · 0 评论 -
LOJ1070:Algebraic Problem(矩阵快速幂 & 数学 a^n+b^n)
1070 - Algebraic Problem PDF (English)StatisticsForumTime Limit: 2 second(s)Memory Limit: 32 MBGiven the value of a+b and ab you will have to find the原创 2017-10-13 17:31:23 · 547 阅读 · 0 评论 -
HDU1452:Happy 2004(数论 & 唯一分解)
Consider a positive integer X,and let S be the sum of all positive integer divisors of 2004^X. Your job is to determine S modulo 29 (the rest of the division of S by 29). Take X = 1 for an example原创 2017-10-23 22:48:40 · 421 阅读 · 0 评论