自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

codeswarrior的博客

学习心得和知识分享

  • 博客(118)
  • 收藏
  • 关注

原创 Sparse Graph HDU - 5876(求补图最短路BFS)

Sparse Graph HDU - 5876In graph theory, the complement of a graph G is a graph H on the same vertices such that two distinct vertices of H are adjacent if and only if they are not adjacent in G.No...

2018-08-31 19:11:46 221

原创 Function HDU - 5875(暴力+思维)

Function HDU - 5875The shorter, the simpler. With this problem, you should be convinced of this truth.You are given an array A of N postive integers, and M queries in the form (l,r). A function F(...

2018-08-31 18:43:33 250

原创 Friends and Enemies HDU - 5874(思维)

Friends and Enemies HDU - 5874 On an isolated island, lived some dwarves. A king (not a dwarf) ruled the island and the seas nearby, there are abundant cobblestones of varying colors on the island. ...

2018-08-31 18:30:37 160

原创 Football Games HDU - 5873(兰道定理)

Football Games HDU - 5873A mysterious country will hold a football world championships—Abnormal Cup, attracting football teams and fans from all around the world. This country is so mysterious that ...

2018-08-31 18:15:20 339

原创 graph HDU - 5607(矩阵快速幂+K步可达路径)

graph HDU - 5607In a directed graph which has N points and M edges,points are labled from 1 to n.At first I am at point u,at each step I will choose an output edge of the current point at uniform ra...

2018-08-31 10:12:08 289

原创 So Easy! HDU - 4565(构造共轭+矩阵快速幂)

So Easy! HDU - 4565A sequence S n is defined as: Sn=⌈(a+b√)n⌉%mSn=⌈(a+b)n⌉%mS_n = \lceil(a+\sqrt{b})^n\rceil\%mWhere a, b, n, m are positive integers.┌x┐is the ceil of x. For example, ┌3.14┐=4. Y...

2018-08-31 08:54:36 302

原创 斐波那契数列通项公式推导及其类似构造共轭公式反求递推式

一、斐波那契数列通项公式推导我们知道斐波那契数列递推公式fn=fn−1+fn−2(n≥2)fn=fn−1+fn−2(n≥2)f_n = f_{n-1} + f_{n-2} (n \ge 2) 即fn−fn−1−fn−2=0fn−fn−1−fn−2=0f_{n} - f_{n-1} - f_{n-2} = 0求解这个递推关系的一种方法是寻找形式为fn=qnfn=qnf_n = q_n的解...

2018-08-31 07:47:42 4798

原创 Best Solver HDU - 5451(共轭构造+循环节+快速幂)

Best Solver HDU - 5451The so-called best problem solver can easily solve this problem, with his/her childhood sweetheart.It is known that y=(5+26–√)1+2x.y=(5+26)1+2x.y=(5+2\sqrt{6})^{1+2^x}. For ...

2018-08-30 16:44:28 258

原创 Jesus Is Here HDU - 5459(思维+数学递推)

Jesus Is Here HDU - 5459I’ve sent Fang Fang around 201314 text messages in almost 5 years. Why can’t she make sense of what I mean? But Jesus is here!" the priest intoned.Show me your messages.” F...

2018-08-30 14:23:17 216

原创 The Best Path HDU - 5883(欧拉路径/回路+异或和最大)

The Best Path HDU - 5883Alice is planning her travel route in a beautiful valley. In this valley, there are N lakes, and M rivers linking these lakes. Alice wants to start her trip from one lake, an...

2018-08-30 10:45:39 184

原创 Problem I. Count HDU - 6434(欧拉函数)

Problem I. Count HDU - 6434 Multiple query, for each n, you need to getn i-1∑ ∑ [gcd(i + j, i - j) = 1]i=1 j=1 Input On the first line, there is a positive integer T, which describe the n...

2018-08-27 17:03:15 324

原创 Problem G. Cyclic HDU - 6432(容斥原理)

Problem G. Cyclic HDU - 6432 Count the number of cyclic permutations of length n with no continuous subsequence [i, i + 1 mod n].Output the answer modulo 998244353. Input The first line of ...

2018-08-27 16:41:03 348 2

原创 Tree and Permutation HDU - 6446(树形dp)

Tree and Permutation HDU - 6446There are N vertices connected by N−1 edges, each edge has its own length. The set { 1,2,3,…,N } contains a total of N! unique permutations, let’s say the i-th permut...

2018-08-27 16:15:09 298

原创 Average distance HDU - 2376(树形dp求树上任意两点距离和的平均值)

Average distance HDU - 2376Given a tree, calculate the average distance between two vertices in the tree. For example, the average distance between two vertices in the following tree is (d 01 + d 02...

2018-08-27 15:01:02 1396

原创 Buy and Resell HDU - 6438(贪心+优先队列)

Buy and Resell HDU - 6438The Power Cube is used as a stash of Exotic Power. There are n cities numbered 1,2,…,n where allowed to trade it. The trading price of the Power Cube in the i-th city is ai ...

2018-08-27 13:45:59 449

原创 Buy Low Sell High CodeForces - 867E(贪心+优先队列)

Buy Low Sell High CodeForces - 867EYou can perfectly predict the price of a certain stock for the next N days. You would like to profit on this knowledge, but only want to transact one share of stoc...

2018-08-27 13:29:41 330

原创 Find Integer HDU - 6441(费马大定理+勾股数)

Find Integer HDU - 6441people in USSS love math very much, and there is a famous math problem .give you two integers n,a,you are required to find 2 integers b,c such that an+bn=cnan+bn=cna^n+b^n=c...

2018-08-27 11:07:44 271

原创 Gcd(莫比乌斯反演)

Gcd给定整数N,求1<=x,y<=N且Gcd(x,y)为素数的数对(x,y)有多少对.Input一个整数NOutput如题Sample Input 4Sample Output 4 Hinthint对于样例(2,2),(2,4),(3,3),(4,2)1<=N<=10^7题意:略分析:...

2018-08-23 08:23:05 637

原创 Mophues(莫比乌斯反演+分段)

Mophues As we know, any positive integer C ( C >= 2 ) can be written as the multiply of some prime numbers: C = p1×p2× p3× ... × pkwhich p1, p2 ... pk are all prime numbers.For example, if C...

2018-08-22 20:02:36 411

原创 Primes in GCD Table SPOJ - PGCD(莫比乌斯反演+分段)

Primes in GCD Table SPOJ - PGCDJohnny has created a table which encodes the results of some operation -- a function of two arguments. But instead of a boring multiplication table of the sort you lea...

2018-08-21 20:29:47 264 1

原创 Character Encoding HDU - 6397(容斥原理解决方程解个数经典问题详解)

Character Encoding HDU - 6397In computer science, a character is a letter, a digit, a punctuation mark or some other similar symbol. Since computers can only process numbers, number codes are used t...

2018-08-21 13:59:58 1614

原创 cf 997c Sky Full of Stars(组合数+容斥原理)

Sky Full of StarsOn one of the planets of Solar system, in Atmosphere University, many students are fans of bingo game.It is well known that one month on this planet consists of n2 days, so calen...

2018-08-21 13:58:24 797

原创 Visible Lattice Points(莫比乌斯反演经典)

Visible Lattice PointsConsider a N*N*N lattice. One corner is at (0,0,0) and the opposite one is at (N,N,N). How many lattice points are visible from corner at (0,0,0) ? A point X is visible from po...

2018-08-20 19:53:30 646

原创 Cutting Codeforces Round #493 (Div. 2)(贪心+思维)

CuttingThere are a lot of things which could be cut — trees, paper, “the rope”. In this problem you are going to cut a sequence of integers.There is a sequence of integers, which contains the equa...

2018-08-20 19:06:02 452

原创 Hunters HDU - 4438 (概率期望)

Hunters HDU - 4438 Alice and Bob are the topmost hunters in the forest, so no preys can escape from them. However, they both think that its hunting skill is better than the other. So they need a mat...

2018-08-16 18:58:57 8585

原创 Sum Of Gcd(欧拉函数+莫队算法详解)

Sum Of Gcd Given you a sequence of number a 1, a 2, ..., a n, which is a permutation of 1...n.You need to answer some queries, each with the following format:Give you two numbers L, R, you should ...

2018-08-15 21:26:46 487

原创 GuGuFishtion HDU - 6390(莫比乌斯反演+线性求逆元)

GuGuFishtion HDU - 6390Today XianYu is too busy with his homework, but the boring GuGu is still disturbing him!!!!!! At the break time, an evil idea arises in XianYu’s mind. ‘Come on, you xxxxxxx ...

2018-08-15 10:48:39 539 2

原创 线性时间筛选n个模M的逆元的方法及证明

结论:假设取模MMM初始化设inv[1]=1inv[1]=1inv[1] = 1则inv[i]=(M−Mi)×inv[M % i] % Minv[i]=(M−Mi)×inv[M % i] % Minv[i] = (M - \frac{M}{i}) \times inv[M\ \%\ i]\ \%\ M...

2018-08-15 09:44:42 288

原创 Swordsman HDU - 6396(优先队列+输入外挂)

Swordsman HDU - 6396Lawson is a magic swordsman with k kinds of magic attributes v1,v2,v3,…,vk. Now Lawson is faced with n monsters and the i-th monster also has k kinds of defensive attributes ai,1...

2018-08-14 12:32:13 227

原创 HDU 5223 GCD(模拟)

HDU 5223 GCDIn mathematics, the greatest common divisor (gcd) of two or more integers, when at least one of them is not zero, is the largest positive integer that divides the numbers without a remai...

2018-08-14 08:40:56 375

原创 HDU 4675 GCD of Sequence(数论+组合数学||莫比乌斯反演)

GCD of Sequence Alice is playing a game with Bob.Alice shows N integers a 1, a 2, …, a N, and M, K. She says each integers 1 ≤ a i ≤ M.And now Alice wants to ask for each d = 1 to M, how many diff...

2018-08-13 20:03:50 362

原创 Jacobi symbol(二次剩余+欧拉准则)

Jacobi symbolConsider a prime number p and an integer a !≡ 0 (mod p). Then a is called a quadratic residue mod p if there is an integer x such that x 2 ≡ a (mod p), and a quadratic non residue other...

2018-08-13 11:14:08 2822

原创 Can you find it HDU5478(数学归纳法思想+快速幂)

Can you find it —HDU5478Given a prime numberC(1≤C≤2×105)C(1≤C≤2×105) C(1≤C≤2×10^5), and three integers k1,b1,k2(1≤k1,k2,b1≤109)k1,b1,k2(1≤k1,k2,b1≤109)k1, b1, k2 (1≤k1,k2,b1≤10^9). Please find all p...

2018-08-13 10:22:02 160

原创 Disgruntled Judge(扩展欧几里得)

Disgruntled Judge Once upon a time, there was an nwerc judge with a tendency to create slightly too hard problems. As a result, his problems were never solved. As you can image, this made our judge ...

2018-08-13 09:27:42 352

原创 hdu2973 YAPTCHA(威尔逊定理)

hdu2973 YAPTCHA The math department has been having problems lately. Due to immense amount of unsolicited automated programs which were crawling across their pages, they decided to put Yet-Another-P...

2018-08-12 13:20:06 468

原创 Co-prime(容斥定理+数论)

Co-prime Given a number N, you are asked to count the number of integers between A and B inclusive which are relatively prime to N.Two integers are said to be co-prime or relatively prime if they h...

2018-08-12 11:15:16 275

原创 Primitive Roots(原根个数)

Primitive RootsWe say that integer x, 0 < x < p, is a primitive root modulo odd prime p if and only if the set { (x i mod p) | 1 <= i <= p-1 } is equal to { 1, ..., p-1 }. For example, t...

2018-08-12 10:51:44 1779

原创 原根 51nod 1135(原根)

原根设m是正整数,a是整数,若a模m的阶等于φ(m),则称a为模m的一个原根。(其中φ(m)表示m的欧拉函数)给出1个质数P,找出P最小的原根。Input 输入1个质数P(3 <= P <= 10^9) Output 输出P最小的原根。 Sample Input3Sample Output2题意:求一个质数的最小原根...

2018-08-12 10:43:56 331 1

原创 Mod Tree(扩展BSGS)

Mod Tree The picture indicates a tree, every node has 2 children. The depth of the nodes whose color is blue is 3; the depth of the node whose color is pink is 0. Now out problem is so easy, g...

2018-08-12 09:49:54 271

原创 POJ2417 Discrete Logging (离散对数取模)

Discrete LoggingGiven a prime P, 2 <= P < 2 31, an integer B, 2 <= B < P, and an integer N, 1 <= N < P, compute the discrete logarithm of N, base B, modulo P. That is, find an inte...

2018-08-11 19:55:57 325

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除