
ACM数论
PCCCCC
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
洛谷P3812 【模板】(线性基模板题)同样可解SGU 275
题目背景这是一道模板题。题目描述给定n个整数(数字可能重复),求在这些数中选取任意个,使得他们的异或和最大。输入输出格式输入格式:第一行一个数n,表示元素个数接下来一行n个数输出格式:仅一行,表示答案。输入输出样例输入样例#1: 复制21 1输出样例#1: 复制1就是一个线性基的模板题,就直接上代码了#...原创 2019-03-14 15:39:12 · 241 阅读 · 0 评论 -
HDU 2866 Special Prime
Problem DescriptionGive you a prime number p, if you could find some natural number (0 is not inclusive) n and m, satisfy the following expression:We call this p a “Special Prime”.AekdyCoi...原创 2019-07-30 14:33:48 · 134 阅读 · 0 评论 -
Beijing 2008 hdu 1852
Problem DescriptionAs we all know, the next Olympic Games will be held in Beijing in 2008. So the year 2008 seems a little special somehow. You are looking forward to it, too, aren't you? Unfortunat...原创 2019-07-20 21:59:55 · 151 阅读 · 0 评论 -
HDU 2197
Problem Description由0和1组成的串中,不能表示为由几个相同的较小的串连接成的串,称为本原串,有多少个长为n(n<=100000000)的本原串?答案mod2008.例如,100100不是本原串,因为他是由两个100组成,而1101是本原串。Input输入包括多个数据,每个数据一行,包括一个整数n,代表串的长度。Output对于每个测试数据,输出一行...原创 2019-07-30 13:40:05 · 140 阅读 · 0 评论 -
Number Sequence hdu 1005(循环节)
Problem DescriptionA number sequence is defined as follows:f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.Given A, B, and n, you are to calculate the value of f(n).InputThe inp...原创 2019-07-20 20:11:27 · 180 阅读 · 0 评论 -
Happy 2004 hdu 1452
Problem DescriptionConsider 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 =...原创 2019-07-20 19:37:45 · 124 阅读 · 0 评论 -
HDU 2582 f(n)(打表找规律)
Problem DescriptionThis time I need you to calculate the f(n) . (3<=n<=1000000)f(n)= Gcd(3)+Gcd(4)+…+Gcd(i)+…+Gcd(n).Gcd(n)=gcd(C[n][1],C[n][2],……,C[n][n-1])C[n][k] means the number of way ...原创 2019-07-30 02:08:31 · 317 阅读 · 0 评论 -
七夕节 Hdu 1215
Problem Description七夕节那天,月老来到数字王国,他在城门上贴了一张告示,并且和数字王国的人们说:"你们想知道你们的另一半是谁吗?那就按照告示上的方法去找吧!"人们纷纷来到告示前,都想知道谁才是自己的另一半.告示如下:数字N的因子就是所有比N小又能被N整除的所有正整数,如12的因子有1,2,3,4,6.你想知道你的另一半吗?Input输入数据的第一行...原创 2019-07-20 16:05:13 · 178 阅读 · 0 评论 -
The number of divisors(约数) about Humble Numbers hdu 1492
Problem DescriptionA number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, ... shows the first...原创 2019-07-20 15:56:13 · 132 阅读 · 0 评论 -
Largest prime factor hdu 2136 (埃氏筛)
Problem DescriptionEverybody knows any number can be combined by the prime number.Now, your task is telling me what position of the largest prime factor.The position of prime 2 is 1, prime 3 is 2,...原创 2019-07-20 15:40:18 · 135 阅读 · 0 评论 -
Intergalactic Bidding (java大数的运用)
DescriptionToday the Intergalactic Council of Pebble Coins (ICPC) conducted an intergalactic auction of the Neutronium Chaos Pebble Coin (NCPC). This coin, which was forged in the Ancient Coin Machi...原创 2019-03-13 20:07:30 · 351 阅读 · 0 评论 -
codefoces Zero Quantity Maximization (map + gcd)详解
D. Zero Quantity Maximizationtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two arrays aa and bb , each contains ...原创 2019-03-13 01:27:45 · 296 阅读 · 0 评论 -
关于为什么求最大异或和一定要先求出线性基,不能直接拿原来的值直接异或的问题
这个问题也困扰了我很久,下面我们看求最大异或和的代码(部分),b是储存得到的线性基for(int i = len - 1; i >= 0; --i){ if((ans ^ b[i]) > ans){ ans ^= b[i]; }}举一个例子就好了。比如我们有6,5,4个数,要求最大异或和,我们先写出它们的二进制110101100如果我们直接用6,...原创 2019-03-19 15:52:00 · 382 阅读 · 4 评论 -
BZOJ 2115 (线性基)详解
题目描述输入第一行包含两个整数N和 M, 表示该无向图中点的数目与边的数目。 接下来M 行描述 M 条边,每行三个整数Si,Ti ,Di,表示 Si 与Ti之间存在 一条权值为 Di的无向边。 图中可能有重边或自环。输出仅包含一个整数,表示最大的XOR和(十进制结果),注意输出后加换行回车。样例输入5 71 2 21 3 22 4 12 5 14 5 35 ...原创 2019-03-15 01:53:07 · 390 阅读 · 1 评论 -
hdu3949 XOR (线性基求第k小的数)详解
Problem DescriptionXOR is a kind of bit operator, we define that as follow: for two binary base number A and B, let C=A XOR B, then for each bit of C, we can get its value by check the digit of corr...原创 2019-03-14 20:46:45 · 721 阅读 · 0 评论 -
codeforces 719E (线段树 + 矩阵快速幂)
E. Sasha and Arraytime limit per test5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSasha has an array of integersa1, a2, ..., an. You have to pe...原创 2019-08-20 00:30:40 · 269 阅读 · 0 评论