自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(99)
  • 收藏
  • 关注

原创 LCA练习题

poj1330题意:求祖先,解释了啥是LCA。 想法:模板。#include<cstdio>#include<algorithm>#include<cstring>#include<vector>using namespace std;#define M 100009int f[M],in[M],ancestor[M];vector<int> tree[M],query[M];in

2017-11-11 15:23:21 1142 1

原创 HDU 6129 Just do it【杨辉三角】

题目来戳呀Problem DescriptionThere is a nonnegative integer sequence a1…n of length n. HazelFan wants to do a type of transformation called prefix-XOR, which means a1…n changes into b1…n, where bi eq...

2017-08-18 21:05:35 355

原创 HDU 6127 Hard challenge【极角排序】

题目来戳呀Problem DescriptionThere are n points on the plane, and the ith points has a value vali, and its coordinate is (xi,yi). It is guaranteed that no two points have the same coordinate, and no two poi

2017-08-18 20:19:34 318

原创 HDU 6140 Hybrid Crystals【思维】

题目来戳呀Problem Description Kyber crystals, also called the living crystal or simply the kyber, and known as kaiburr crystals in ancient times, were rare, Force-attuned crystals that grew in nature and

2017-08-18 17:25:35 335

原创 HDU 6143 Killer Names【容斥定理】【排列组合】

题目来戳呀Problem Description Galen Marek, codenamed Starkiller, was a male Human apprentice of the Sith Lord Darth Vader. A powerful Force-user who lived during the era of the Galactic Empire, Marek orig

2017-08-18 10:20:07 440

原创 POJ 2976 Dropping tests【分数规划】【二分搜索】

题目来戳呀#include#include#include#includeusing namespace std;double a[1100],b[1100],f[1100];;const double acc=1e-7;int main(){ int n,k; double mid,ans; while(~scanf("%d%d",&n,&k))

2017-08-16 17:30:22 222

原创 数论之组合数取模

组合数取模:CmnC_n^m % p三个链接表示的是该种方法的定理定义之类的~怕三种方法合在一起太长(ノ`Д)ノ一、杨辉三角打表求组合数——1≤m≤n≤1000,1≤p≤10910^9int Combination(int n) { int i,j; a[0][0]=1; for(i=0;i<=n;i++) { a[

2017-08-16 16:36:17 339

转载 数论之Lucas定理及证明过程

转自这里 http://blog.csdn.net/m674019130/article/details/76149170        Lucas定理主要用于组合数取模。<span class="math" id="MathJax-Span-1" style="width: 16.269em; display: inline-block;"><span sty

2017-08-16 16:16:47 551

原创 数论之杨辉三角

一、定义杨辉三角,是二项式系数在三角形中的一种几何排列。在欧洲,这个表叫做帕斯卡三角形(Pascal三角形)。 (注意图上是从第0行开始的+_+)二、性质前提:每行端点与结尾的数为1.每个数等于它上方两数之和。每行数字左右对称,由1开始逐渐变大。第n行的数字有n项。第n行数字和为2n-1。第n行的第m个数可表示为Cm−1n−1C_{n-1}^{m-1},即为从n-1个不同元素中取m-

2017-08-16 15:42:04 1469

原创 HDU 6130 Kolakoski【找规律】

题目来戳呀Problem DescriptionThis is Kolakosiki sequence: 1,2,2,1,1,2,1,2,2,1,2,2,1,1,2,1,1,2,2,1……. This sequence consists of 1 and 2, and its first term equals 1. Besides, if you see adjacent and equal te

2017-08-15 20:20:43 963

原创 HDU 6070 Dirt Ratio【分数规划】【线段树】

题目来戳呀Problem DescriptionIn ACM/ICPC contest, the ”Dirt Ratio” of a team is calculated in the following way. First let’s ignore all the problems the team didn’t pass, assume the team passed X problems d

2017-08-15 11:00:19 233

原创 动态规划之01分数规划

不完全转载自这里 原文还有习题一、定义所谓的01分数规划问题是指这样的一类问题,给定两个数组,a[i]表示选取i的收益,b[i]表示选取i的代价。 求一个选择方案使得R=∑(a[i]∗x[i])∑(b[i]∗x[i])\frac{\sum(a[i]*x[i])}{\sum(b[i]*x[i])}取得最值,x[i]=0或x[i]=1,即物品只有拿或不拿两种方式。 01分数规划问题主要包含一般的01

2017-08-15 10:39:54 485 1

原创 HDU 6078 Wavel Sequence【动态规划】

题目来戳呀Problem DescriptionHave you ever seen the wave? It’s a wonderful view of nature. Little Q is attracted to such wonderful thing, he even likes everything that looks like wave. Formally, he defines

2017-08-14 17:05:23 293

原创 HDU 6063 RXD and math【快速幂】【打表找规律】

题目来戳呀Problem DescriptionRXD is a good mathematician. One day he wants to calculate: output the answer module 10^9+7. 1≤n,k≤10^18 μ(n)=1(n=1)μ(n)=(−1)k(n=p1p2…pk)μ(n)=0(otherwise)p1,p2,p3…pk are dif

2017-08-14 16:25:22 295

原创 HDU 6097 Mindis【计算几何】

题目来戳呀Problem DescriptionThe center coordinate of the circle C is O, the coordinate of O is (0,0) , and the radius is r. P and Q are two points not outside the circle, and PO = QO. You need to find a

2017-08-14 09:59:12 321

原创 HDU 6060 RXD and dividing

题目来戳呀Problem DescriptionRXD has a tree T, with the size of n. Each edge has a cost. Define f(S) as the the cost of the minimal Steiner Tree of the set S on tree T. he wants to divide 2,3,4,5,6,…n in

2017-08-12 09:54:53 168

原创 HDU 6098 Inversion【思维】

题目来戳呀Problem DescriptionGive an array A, the index starts from 1. Now we want to know Bi=maxi∤jAj , i≥2.InputThe first line of the input gives the number of test cases T; T test cases follow. Each ca

2017-08-11 09:28:15 250

原创 HDU 6059 Kanade's trio【字典树】

题目来戳呀Problem DescriptionGive you an array A[1..n],you need to calculate how many tuples (i,j,k) satisfy that (i<j<k) and (AiA_i xor AjA_j )< (AjA_j xor AkA_k) There are T test cases.1≤T≤201≤∑n≤5∗1050≤

2017-08-10 23:49:27 286

原创 HDU 6106 Classes【简单思维】

题目来戳呀Problem DescriptionThe school set up three elective courses, assuming that these courses are A, B, C. N classes of students enrolled in these courses. Now the school wants to count the number of

2017-08-10 22:58:35 259

原创 HDU 6069 Counting Divisors【素数筛】【约数个数定理】

题目来戳呀Problem DescriptionIn mathematics, the function d(n) denotes the number of divisors of positive integer n.For example, d(12)=6 because 1,2,3,4,6,12 are all 12’s divisors.In this problem, given l,r

2017-08-09 23:23:41 438

原创 HDU 6058 Kanade's sum

Problem DescriptionGive you an array A[1..n]of length n. Let f(l,r,k) be the k-th largest element of A[l..r].Specially , f(l,r,k)=0 if r−l+1InputThere is only one integer T on first line.F

2017-08-08 09:00:43 184

原创 HDU 6052 To my boyfriend【思维】

题目来戳呀Problem DescriptionDear LiaoI never forget the moment I met with you. You carefully asked me: “I have a very difficult problem. Can you teach me?”. I replied with a smile, “of course”. You replied

2017-08-03 20:05:34 446

原创 HDU 6050 Funny Function

题目来戳呀InputThere is one integer T in the first line. The next T lines,each line includes two integers N and M . 1<=T<=10000,1<=N,M<2^63.OutputFor each given N and M,print the answer in a single line.S

2017-08-03 15:40:36 175

原创 HDU 6053 TrickGCD 【容斥定理】【莫比乌斯函数】

Problem DescriptionYou are given an array A , and Zhu wants to know there are how many different array B satisfy the following conditions?1≤Bi≤AiFor each pair( l , r ) (1≤l≤r≤n) , gcd(bl,bl+1…br)≥2I

2017-08-01 19:39:48 463

原创 HDU 6047 Maximum Sequence【贪心】

题目来戳呀Problem DescriptionSteph is extremely obsessed with “sequence problems” that are usually seen on magazines: Given the sequence 11, 23, 30, 35, what is the next number? Steph always finds them too

2017-07-30 23:45:56 220

原创 HDU 6055 Regular polygon【几何】

题目来戳呀 和poj2002也是很类似的~poj2002Problem DescriptionOn a two-dimensional plane, give you n integer points. Your task is to figure out how many different regular polygon these points can make.InputThe input

2017-07-30 16:35:25 261

原创 HDU 6045 Is Derek lying?【思维】

题目来戳呀Problem DescriptionDerek and Alfia are good friends.Derek is Chinese,and Alfia is Austrian.This summer holiday,they both participate in the summer camp of Borussia Dortmund.During the summer camp,

2017-07-29 22:59:44 402

原创 HDU 6038 Function【思维】

题目来戳呀Problem DescriptionYou are given a permutation a from 0 to n−1 and a permutation b from 0 to m−1.Define that the domain of function f is the set of integers from 0 to n−1, and the range of it is t

2017-07-29 09:08:55 390

原创 2017 Multi-University Training Contest - Team 1 HDU 6033 Add More Zero【对数】

题目来戳呀Problem DescriptionThere is a youngster known for amateur propositions concerning several mathematical hard problems.Nowadays, he is preparing a thought-provoking problem on a specific type of sup

2017-07-28 13:57:12 187

原创 2017 Multi-University Training Contest - Team 1 HDU 6035 Colorful Tree

题目来戳呀Problem DescriptionThere is a tree with n nodes, each of which has a type of color represented by an integer, where the color of node i is ci.The path between each two different nodes is unique, o

2017-07-28 13:42:23 226

原创 HDU 6034 Balala Power!【贪心】

Problem Description Talented Mr.Tang has n strings consisting of only lower case characters. He wants to charge them with Balala Power (he could change each character ranged from a to z into each numb

2017-07-26 15:58:28 324

原创 数论之乘法逆元

一、定义指数学领域群G中任意一个元素a,都在G中有唯一的逆元a‘,具有性质a×a’=a’×a=e,其中e为该群的单位元。(可以理解为倒数,因为积是单位e)二、作用在求组合数取模的时候,当CmnC_n^m=n!m!∗(n−m)!\frac{n!}{m!*(n-m)!}中的分母过大时,可能会爆出long long的内存范围,取模处理对于除法并不适用,所以我们可以用逆元将除法换成乘法。三、性质假设b存在乘

2017-07-26 15:21:28 955

原创 山东省第八届acm省赛D题 HEX

题目来戳呀Problem DescriptionOn a plain of hexagonal grid, we define a step as one move from the current grid to the lower/lower-left/lower-right grid. For example, we can move from (1,1) to (2,1), (2,2) or

2017-07-24 20:55:57 211

原创 山东省第八届acm省赛K题 CF

题目来戳呀Problem DescriptionLYD loves codeforces since there are many Russian contests. In an contest lasting for T minutes there are n problems, and for the ith problem you can get ai−di∗ti points, where

2017-07-24 10:57:46 375

原创 山东省第八届acm省赛C题 fireworks

题目来戳呀Problem DescriptionHmz likes to play fireworks, especially when they are put regularly. Now he puts some fireworks in a line. This time he put a trigger on each firework. With that trigger, each

2017-07-23 21:14:17 432

原创 哼哼唧唧学博弈

一、巴什博奕(同余理论) 一堆物品 n个 每人能取出1~m个 甲先拿 乙后拿 若n=m+1 乙胜 若n=k*(m+1) 乙胜 若n=k*(m+1)+r 甲胜1.#include&lt;iostream&gt; 2.using namespace std; 3.int main() 4.{ 5. int cas,total,price; 6. ...

2017-05-26 19:10:56 218

原创 数据结构之线段树

一、引例有M个数排成一列,做N次操作,每次操作包括: (1)询问指定区间的最大值、最小值 (2)将指定区间的每个数加上一个值 如果按照最朴素的做法,一个个的遍历,时间复杂度:O(MN)。 那么如何解决一个区间求和(最大值,最小值)的问题呢?那么就要用到线段树啦。 二、定义 线段树是一种二叉搜索树,与区间树相似,它将一个区间划分成一些单元区间,每个单元区间对应线段树中的一个叶结点。主要用来解

2017-05-15 20:35:44 214

原创 hdu 4521 小明序列

怒 马 一 发! 看了好久,师哥说超!纲!了! 等到会了再回来补坑○| ̄|_

2017-04-05 22:24:06 296

原创 HDU 1087 Super Jumping! Jumping! Jumping!【最长上升子序列元素总和】

Problem DescriptionNowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and know little about this game, so I introduce it to you n

2017-04-04 20:22:51 179

原创 动态规划之最长子序列问题

一个数的序列bi,当b1 < b2 < … < bS的时候,我们称这个序列是上升的。 对于给定的一个序列(a1, a2, …, aN),我们可以得到一些上升的子序列(ai1, ai2, …, aiK),这里1 <= i1 < i2 < … < iK <= N。 比如,对于序列(1, 7, 3, 5, 9, 4, 8),有它的一些上升子序列,如(1, 7), (3, 4, 8)等等。这些子序列中最

2017-04-04 20:04:51 547

空空如也

空空如也

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

TA关注的人

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