自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 51Nod-1640-天气晴朗的魔法 (求最小生成的最大边 的权值k,再求当最大边权值为k是的最大生成树 )

这样阴沉的天气持续下去,我们不免担心起他的健康。51nod魔法学校近日开展了主题为“天气晴朗”的魔法交流活动。N名魔法师按阵法站好,之后选取N - 1条魔法链将所有魔法师的魔力连接起来,形成一个魔法阵。魔法链是做法成功与否的关键。每一条魔法链都有一个魔力值V,魔法最终的效果取决于阵中所有魔法链的魔力值的和。由于逆天改命的魔法过于暴力,所以我们要求阵中的魔法链的魔力值最大值尽可能的小,与此同时,魔力...

2018-04-27 17:58:36 171

原创 2018年湘潭大学程序设计竞赛 H 统计颜色( 区间更新线段树 + 状态压缩 )

n个桶按顺序排列,我们用1~n给桶标号。有两种操作:1 l r c 区间[l,r]中的每个桶中都放入一个颜色为c的球 (1≤l,r ≤n,l≤r,0≤c≤60)2 l r   查询区间[l,r]的桶中有多少种不同颜色的球     (1≤l,r ≤n,l≤r)输入描述:有多组数据,对于每组数据:第一行有两个整数n,m(1≤n,m≤100000)接下来m行,代表m个操作,格式如题目所示。输出描述:...

2018-04-27 17:11:04 198

原创 Cutting Game FZU - 2268 (找规律题,二进制,n最少分出几段,组成小于等于n任意数)

Fat brother and Maze are playing a kind of special (hentai) game with a piece of gold of length N where N is an integer. Although, Fat Brother and Maze can buy almost everything in this world (except ...

2018-04-26 15:14:29 306

原创 X FZU - 2271 (给出一个图,能删除至多多少边使得任意两点之间的最短路径不变)

X is a fully prosperous country, especially known for its complicated transportation networks. But recently, for the sake of better controlling by the government, the president Fat Brother thinks it’s...

2018-04-26 14:39:49 581

原创 The Bigger the Better FZU - 2267 (模拟题,模拟中间有技巧,目前后缀数组不会,暂且不用)

Fat brother and Maze are playing a kind of special (hentai) game with two integers. All the digits of these two integers are in the range from 1 to 9. After they’ve got these two integers, they though...

2018-04-26 14:26:18 201

原创 Card Game (First Edition) FZU - 2264 Card Game (Second Edition) FZU - 2265 (数学期望)

Fat brother and Maze are playing a kind of special (hentai) game with some cards. There are N*2 cards in this game for the players to use, this is the card deck. The game goes for N rounds and in each...

2018-04-26 11:14:54 959

原创 2018 ACM-ICPC 中国大学生程序设计竞赛线上赛 Goldbach(2^63 次方内的素数判断,Miller-Rabin素数检测算法)

Description:Goldbach's conjecture is one of the oldest and best-known unsolved problems in number theory and all of mathematics. It states:Every even integer greater than 2 can be expressed as the sum...

2018-04-24 17:23:25 322

原创 Holedox Moving POJ - 1324 (bfs + 状态压缩+A*)

During winter, the most hungry and severe time, Holedox sleeps in its lair. When spring comes, Holedox wakes up, moves to the exit of its lair, comes out, and begins its new life. Holedox is a special...

2018-04-24 09:23:41 238

原创 Master of GCD HDU - 6273 (区间更新,线段树)

Hakase has n numbers in a line. At first, they are all equal to 1. Besides, Hakase is interested inprimes. She will choose a continuous subsequence [l, r] and a prime parameter x each time and forever...

2018-04-23 21:47:21 1203

原创 Super-palindrome HDU - 6264 (改变字符,把每个字符串的奇数子串都变成回文的,一定要善于观察)

题目描述You are given a string that is consisted of lowercase English alphabet.You are supposed to change it into a super-palindrome string in minimum steps.You can change one character in string to anoth...

2018-04-23 19:45:55 710

原创 2018 ACM-ICPC 中国大学生程序设计竞赛线上赛 (Reversion Count) (一个数和一个数的倒序的差一定是 9的倍数,还有...)

Description:There is a positive integer X, X's reversion count is Y. For example, X=123, Y=321; X=1234, Y=4321. Z=(X-Y)/9, Judge if Z is made up of only one number(0,1,2...9), like Z=11,Z=111,Z=222,do...

2018-04-23 16:20:08 595

原创 2018 ACM-ICPC 中国大学生程序设计竞赛线上赛 Copy and Submit II (结论题,数学,好题)

Description:1// Q.cpp2#include <iostream>3using namespace std;4const long long M = 1000000007;5const long long MAXL = 1000000;6long long a[MAXL];7long long Q(int n, long long t)8{9    if(n < ...

2018-04-23 15:13:06 333

原创 king's trouble II SCU - 4488 (dp,找正方形,dp 最左最右边界 或者 直接dp )

    DescriptionLong time ago, a king occupied a vast territory.Now there is a problem that he worried that he want to choose a largest square of his territory to build a palace.Can you help him?...

2018-04-18 21:16:40 180

原创 Boxes and Balls UVALive - 7500 (找规律,二分搜索)

题目链接:点击打开链接题意:你手里有N个球,现在需要用你手里尽可能多的球使得这个游戏经过多次游戏后形成一种恒定状态,恒定状态:最后形成一种恒定状态的情况是每个盒子里放得球数一定是个连续的序列,1  1,2  1,2,3  1,2,3,4....  思路:经分析:找一个小于等于n的 等差序列前 k 项和,这个等差序列从 a1 = 1  d = 1 n>=(k*(k+1))/2;二分枚举k,即可...

2018-04-17 09:23:14 114

原创 Making the Grade POJ - 3666 (dp 离散化 变成 非严格单调递增 或递减)

A straight dirt road connects two fields on FJ's farm, but it changes elevation more than FJ would like. His cows do not mind climbing up or down a single slope, but they are not fond of an alternatin...

2018-04-17 08:25:41 284

原创 小明系列故事——捉迷藏 HDU - 4528 (标记 四种状态,也可以说是四种状态下的最小步数,很好的题)

  小明的妈妈生了三个孩子,老大叫大明, 老二叫二明, 老三..., 老三自然就叫小明了。  一天,小明的妈妈带小明兄弟三人去公园玩耍,公园里面树木很多,有很多地方可以藏身, 于是他们决定玩捉迷藏。经过几轮的猜拳后,第一轮是小明来找其他两个人,游戏规则很简单:  只要小明可以在规定的时间内找到他们就算小明获胜,并且被发现的两个人猜拳决定谁在下一轮负责找人;如果在规定的时间内只找到一个人,那么没有被...

2018-04-16 21:52:22 238

原创 0和5 51Nod - 1433 (为什么整除找出一个最大的整数能整除3或者9,为什么)

小K手中有n张牌,每张牌上有一个一位数的数,这个字数不是0就是5。小K从这些牌在抽出任意张(不能抽0张),排成一行这样就组成了一个数。使得这个数尽可能大,而且可以被90整除。注意:1.这个数没有前导0,2.小K不需要使用所有的牌。Input每个测试数据输入共2行。 第一行给出一个n,表示n张牌。(1<=n<=1000) 第二行给出n个整数a00,a11,a22,…,an−1n−1 (a...

2018-04-16 14:37:16 1164

原创 Sumsets POJ - 2549 (从 一个 1000数中,找出四个数,满足 a + b = d -c,且求的d最大)

Given S, a set of integers, find the largest d such that a + b + c = d where a, b, c, and d are distinct elements of S.InputSeveral S, each consisting of a line containing an integer 1 <= n <= 1...

2018-04-13 18:05:04 259

原创 1071: zdw的嘤嘤嘤(找一字符串的长度,非严格单调递增,(可以用找 非严格单调递增的 dp,写)(也可用找字符串的dp写,这种挺重要))

1071: zdw的嘤嘤嘤时间限制: 1 Sec  内存限制: 128 MB提交: 53  解决: 14[提交][状态][讨论版]题目描述//感觉会被zdw揍众所周知,zdw是一个萌妹,喜欢嘤嘤嘤。而且最擅长八重嘤和嘤雄不朽。这一天zdw说了一个很长的字符串,只包括 ‘y’ , ‘i’ , ‘n’ ,’g’这四个字符。你需要选取尽量多的下标,让这些下标在这个字符串中对应的字符按下标从小到大的顺序组...

2018-04-13 16:38:25 416

原创 1068: zdw的编译器(模拟题,里面要注意括号配对)

1068: zdw的编译器时间限制: 1 Sec  内存限制: 128 MB提交: 28  解决: 10[提交][状态][讨论版]题目描述zdw参照某种语言的灵感,自创了一种语言,名字叫:AK语言(因为他总能AK)AK语言非常简单,只包含8个符号,以下是关于这种语言的介绍:> 当前指针向右移动< 当前指针向左移动+ 指针指向的字节数值增加1- 指针指向的字节数值减少1? 等待用户输入字...

2018-04-13 15:35:52 149

原创 组合数学 和 dp 的递推式 和杨辉三角 三者之间的联系

1072: 简单的问题时间限制: 1 Sec  内存限制: 128 MB提交: 26  解决: 6[提交][状态][讨论版]题目描述这个问题太简单了以至于出题人想不到什么捏造什么背景了(脑洞缺失那就让我们直奔主题吧:给你一个n,你能否知道,在[0,n)中,有多少数的二进制表示中1的个数和n的二进制表示中1的个数是一样多的?输入:第一行一个T,表示有T组数据其后T行,每行一个整数,代表n输出:n行每...

2018-04-13 11:40:03 204

原创 15 Puzzle(15 数码,IDA* 及 N 数码的 有解无解的判读)

The goal of the 15 puzzle problem is to complete pieces on 4×44×4 cells where one of the cells is empty space.In this problem, the space is represented by 0 and pieces are represented by integers from...

2018-04-12 18:57:22 5535

原创 Pair Of Lines CodeForces - 961D (数学 直线 上的几何)

You are given n points on Cartesian plane. Every point is a lattice point (i. e. both of its coordinates are integers), and all points are distinct.You may draw two straight lines (not necessarily dis...

2018-04-11 08:52:29 200

原创 Tufurama CodeForces - 961E (树状数组 )

 One day Polycarp decided to rewatch his absolute favourite episode of well-known TV series "Tufurama". He was pretty surprised when he got results only for season 7 episode 3 with his search query ...

2018-04-10 21:14:58 224

原创 Ultra-QuickSort POJ - 2299 (数状数组 线段树 归并排序 求逆序数)

In this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted i...

2018-04-10 09:19:48 217

原创 4 Values whose Sum is 0 poj-2785(四个长度为4000的数组,从每个数组中取出一个数,使取出的四个数和为0 二分优化)

The SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, compute how many quadruplet (a, b, c, d ) ∈ A x B x C x D are such that a + b + c + d = 0 . In the followin...

2018-04-09 22:02:02 363

原创 lower_bound() 和 upper_bound() 返回的位置区别

upper_bound 返回第一个大于 k(要查找的数字)的数字的位置;lower_bound 返回第一个等于k的数字位置,或返回第一个大于k数字的位置;自己试验一下代码:#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;int main(){ int ...

2018-04-09 21:28:41 512

原创 8 Puzzle Aizu - ALDS1_13_B (八数码,map去重,bfs())

The goal of the 8 puzzle problem is to complete pieces on 3×33×3 cells where one of the cells is empty space.In this problem, the space is represented by 0 and pieces are represented by integers from ...

2018-04-09 20:41:53 265

原创 hdu - 1950 Bridging signals(最长上升序列,dp 二分求法)

'Oh no, they've done it again', cries the chief designer at the Waferland chip factory. Once more the routing designers have screwed up completely, making the signals on the chip connecting the ports ...

2018-04-07 08:26:11 169

原创 Anniversary party poj 2342(树,树状dp入门 或 两种记忆化搜索可做)

There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees. It means that the supervisor relation forms a tr...

2018-04-06 20:18:39 159

原创 区间dp入门:poj 3280 Cheapest Palindrome poj 2955 Brackets

poj 3280Cheapest PalindromeKeeping track of all the cows can be a tricky task so Farmer John has installed a system to automate it. He has installed on each cow an electronic ID tag that the system w...

2018-04-06 16:50:43 117

原创 Dollar Dayz poj 3181(dp 完全背包 或 不超过m的划分数)

Farmer John goes to Dollar Days at The Cow Store and discovers an unlimited number of tools on sale. During his first visit, the tools are selling variously for $1, $2, and $3. Farmer John has exactly...

2018-04-06 14:11:47 144

原创 Apple Catching (dp 动态规划)

It is a little known fact that cows love apples. Farmer John has two apple trees (which are conveniently numbered 1 and 2) in his field, each full of apples. Bessie cannot reach the apples when they a...

2018-04-03 20:21:29 306

原创 Sumsets (dp, 找规律,找递推式)

Farmer John commanded his cows to search for different sets of numbers that sum to a given number. The cows use only numbers that are an integer power of 2. Here are the possible sets of numbers that ...

2018-04-03 18:11:52 286

空空如也

空空如也

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

TA关注的人

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