自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Codeforces Round #514 (Div. 2) C. Sequence Transformation

C. Sequence Transformation Let's call the following process a transformation of a sequence of length nn.If the sequence is empty, the process ends. Otherwise, append the greatest common divisor ...

2018-10-31 19:38:55 186

原创 Codeforces Round #519 by Botan Investments C. Smallest Word

C. Smallest Word IA has so many colorful magnets on her fridge! Exactly one letter is written on each magnet, 'a' or 'b'. She loves to play with them, placing all magnets in a row. However, the gi...

2018-10-29 20:27:26 301

原创 Educational Codeforces Round 53 (Rated for Div. 2) B. Vasya and Books

B. Vasya and Books Vasya has got nn books, numbered from 11 to nn, arranged in a stack. The topmost book has number a1a1, the next one — a2a2, and so on. The book at the bottom of the stack has nu...

2018-10-29 15:43:58 222

原创 Educational Codeforces Round 53 (Rated for Div. 2) A. Diverse Substring

A. Diverse Substring You are given a string ss, consisting of nn lowercase Latin letters.A substring of string ss is a continuous segment of letters from ss. For example, "defor" is a substring ...

2018-10-28 16:40:50 625

原创 Educational Codeforces Round 52 (Rated for Div. 2) C. Make It Equal

C. Make It Equal There is a toy building consisting of nn towers. Each tower consists of several cubes standing on each other. The ii-th tower consists of hihicubes, so it has height hihi.Let's ...

2018-10-27 17:36:14 183

原创 Wannafly挑战赛27 A 灰魔法师

链接:https://www.nowcoder.com/acm/contest/215/A来源:牛客网 题目描述“White shores, and beyond. A far green country under a swift sunrise.”--灰魔法师给出长度为n的序列a, 求有多少对数对 (i, j) (1 <= i < j <= n) 满足 ai +...

2018-10-27 09:30:39 320

原创 Mail.Ru Cup 2018 Round 1 C. Candies Distribution

C. Candies Distribution There are nn children numbered from 11 to nn in a kindergarten. Kindergarten teacher gave aiai (1≤ai≤n1≤ai≤n) candies to the ii-th child. Children were seated in a row in o...

2018-10-26 11:25:14 464

原创 Mail.Ru Cup 2018 Round 1 B. Appending Mex

B. Appending Mex Initially Ildar has an empty array. He performs nn steps. On each step he takes a subset of integers already added to the array and appends the mex of this subset to the array.T...

2018-10-25 10:17:26 289

原创 Codeforces Round #516 (Div. 2, by Moscow Team Olympiad) B. Equations of Mathematical Magic

B. Equations of Mathematical Magic Colossal! — exclaimed Hawk-nose. — A programmer! That's exactly what we are looking for.Arkadi and Boris Strugatsky. Monday starts on SaturdayReading the boo...

2018-10-23 10:15:34 180

原创 编程练习赛80 A 禁止登录

描述为了提升用户帐号的安全性,H站决定实施一项措施:对在1小时内(注:00:00:00与01:00:00仍视为在1小时内)出现5次或5次以上密码错误的账户,暂时禁止该帐号被登录。  现在小Hi拿到了某日全部密码错误的日志,他想知道有哪些帐号被暂时禁止登录。输入第一行包含一个整数N,代表记录的行数。  以下N行每行包含一个整数A和一个时间T。其中是A代表密码错误的账号ID;T代表...

2018-10-21 14:24:19 877

原创 Educational Codeforces Round 51 (Rated for Div. 2) A. Vasya And Password

A. Vasya And Password Vasya came up with a password to register for EatForces — a string ss. The password in EatForces should be a string, consisting of lowercase and uppercase Latin letters and d...

2018-10-20 10:58:04 164

原创 Manthan, Codefest 18 (rated, Div. 1 + Div. 2) D. Valid BFS?

D. Valid BFS?The BFS algorithm is defined as follows.Consider an undirected graph with vertices numbered from 11 to nn. Initialize qq as a new queue containing only vertex 11, mark the vertex 11as...

2018-10-10 09:33:59 143

原创 Codeforces Round #508 (Div. 2) D. Slime

D. SlimeThere are nn slimes in a row. Each slime has an integer value (possibly negative or zero) associated with it.Any slime can eat its adjacent slime (the closest slime to its left or to its r...

2018-10-09 09:29:03 218

原创 Codeforces Round #509 (Div. 2) C. Coffee Break

C. Coffee BreakRecently Monocarp got a job. His working day lasts exactly mm minutes. During work, Monocarp wants to drink coffee at certain moments: there are nn minutes a1,a2,…,ana1,a2,…,an, when ...

2018-09-28 19:03:50 392

原创 Codeforces Round #510 (Div. 2) C. Array Product

C. Array ProductYou are given an array aa consisting of nn integers. You can perform the following operations with it:Choose some positions ii and jj (1≤i,j≤n,i≠j1≤i,j≤n,i≠j), write the value of a...

2018-09-26 16:34:07 181

原创 Codeforces Round #487 (Div. 2) C. A Mist of Florescence

C. A Mist of Florescence As the boat drifts down the river, a wood full of blossoms shows up on the riverfront."I've been here once," Mino exclaims with delight, "it's breathtakingly amazing."...

2018-07-19 11:57:57 167

原创 Educational Codeforces Round 45 (Rated for Div. 2) C. Bracket Sequences Concatenation Problem

C. Bracket Sequences Concatenation ProblemA bracket sequence is a string containing only characters "(" and ")".A regular bracket sequence is a bracket sequence that can be transformed into a correct ...

2018-07-13 09:22:06 160

原创 Codeforces Round #486 (Div. 3) C. Equal Sums map+结构体

C. Equal SumsYou are given kk sequences of integers. The length of the ii-th sequence equals to nini.You have to choose exactly two sequences ii and jj (i≠ji≠j) such that you can remove exactly one el...

2018-07-11 15:07:40 132

原创 Codeforces Round #486 (Div. 3) B. Substrings Sort

B. Substrings SortYou are given nn strings. Each string consists of lowercase English letters. Rearrange (reorder) the given strings in such a way that for every string, all strings that are placed be...

2018-07-11 08:31:09 105

原创 Avito Code Challenge 2018 C. Useful Decomposition

C. Useful DecompositionRamesses knows a lot about problems involving trees (undirected connected graphs without cycles)!He created a new useful tree decomposition, but he does not know how to construc...

2018-07-09 14:32:49 141

原创 错排计数 HDU-2048

题意:求没有一个人中奖的概率,即所有人都同时没有给自己对上号,即错排成功的概率。思路:求出总的可能情况数:n的全排列即n!。求出所有错排的可能情况数:即n的错排计数D(n)。那么错排成功的概率p=D(n)/n!。错排递推关系式:Di=(i-1)*(Di-1+Di-2),初始化D1=0,D2=1。设第x个元素位于第k位置上,对于第k个元素,它的位置可能在第x个位置上:那么此时(n-1)*Di-2。也...

2018-05-24 20:12:20 219

原创 Educational Codeforces Round 44 (Rated for Div. 2) C. Liebig's Barrels

C. Liebig's BarrelsYou have m = n·k wooden staves. The i-th stave has length ai. You have to assemble n barrels consisting of k staves each, you can use any k staves to construct a barrel. Each stave ...

2018-05-23 18:06:07 277

原创 Codeforces Round #483 (Div. 2) [Thanks, Botan Investments and Victor Shaburov!] A. Game

A. GameTwo players play a game.Initially there are nn integers a1,a2,…,ana1,a2,…,an written on the board. Each turn a player selects one number and erases it from the board. This continues until there...

2018-05-23 18:00:57 174

原创 Codeforces Round #478 (Div. 2) C. Valhalla Siege

C. Valhalla SiegeIvar the Boneless is a great leader. He is trying to capture Kattegat from Lagertha. The war has begun and wave after wave Ivar's warriors are falling in battle.Ivar has nn warriors, ...

2018-05-11 16:57:48 245

原创 Codeforces Round #478 (Div. 2) B. Mancala

B. MancalaMancala is a game famous in the Middle East. It is played on a board that consists of 14 holes.Initially, each hole has aiai stones. When a player makes a move, he chooses a hole which conta...

2018-05-11 16:44:52 183

原创 Codeforces Round #478 (Div. 2) A. Aramic script

A. Aramic scriptIn Aramic language words can only represent objects.Words in Aramic have special properties:A word is a root if it does not contain the same letter more than once.A root and all its pe...

2018-05-11 16:28:37 93

原创 Codeforces Round #480 (Div. 2) C. Posterized

C. PosterizedProfessor Ibrahim has prepared the final homework for his algorithm’s class. He asked his students to implement the Posterization Image Filter.Their algorithm will be tested on an array o...

2018-05-09 16:21:53 337

原创 Codeforces Round #480 (Div. 2) B. Marlin

B. MarlinThe city of Fishtopia can be imagined as a grid of 44 rows and an odd number of columns. It has two main villages; the first is located at the top-left cell (1,1)(1,1), people who stay there ...

2018-05-09 16:12:52 244

原创 Codeforces Round #480 (Div. 2) A. Links and Pearls

A. Links and PearlsA necklace can be described as a string of links ('-') and pearls ('o'), with the last link or pearl connected to the first one.You can remove a link or a pearl and insert it betwee...

2018-05-09 15:40:09 244

原创 POJ-1463 Strategic game (树形DP)

题意:在一棵树上,当前节点i只能监视到下一个节点,如果有多个节点直接连接i,可以同时监视,问最少需要放多少士兵监视所有的节点。思路:很明显,对于任一节点i,只有两种情况,放或者不放,所以定义dp[i][0]表示i节点不放士兵,把以i为根节点的整棵子树全部监视所需的最少士兵,dp[i][1]即放士兵所需的最小士兵。设当前节点为i,i的直接子节点为j:dp[i][0]+=dp[j][1]   (当前不...

2018-04-26 14:31:24 96

原创 HDU-2196 Computer (树形DP)

题意:求树上任一节点i能够到达的最远距离。思路:针对任一节点i,都有两个方向,一个向i的子树方向延伸,一个向父节点方向延伸,比较这两个方向距离取max即为最远。当然直接遍历会超时,我们定义dp[i][0]:i节点向子树方向的最远距离。dp[i][1]:i节点向子树方向的次远距离。(不经过最远距离子树的另外路径)dp[i][2]:i节点向父节点方向的最远距离。首先我们来求解dp[i][0],dp[i...

2018-04-25 18:46:47 223

原创 POJ-2342 Anniversary party (树形DP)

Anniversary partyTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 10417 Accepted: 5957DescriptionThere is going to be a party to celebrate the 80-th Anniversary of the Ural State University. ...

2018-04-24 17:08:00 98

原创 HDU-1078 FatMouse and Cheese (线性DP)

Problem DescriptionFatMouse has stored some cheese in a city. The city can be considered as a square grid of dimension n: each grid location is labelled (p,q) where 0 <= p < n and 0 <= q <...

2018-04-23 16:52:02 244

原创 HDU-1087 Super Jumping! Jumping! Jumping! (线性DP)

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 ...

2018-04-23 16:38:39 107

原创 整数划分-划分数(DP动态规划)

给你一个正整数n,让你计算出n的m划分有几种方法。思路:定义dp[i][j]为i的j划分,即将i划分为j个数字之和的方案数。1:当j<=i时,此时,划分个数不超过i,此时是正常的划分。     划分的结果一定只有两种类型:一种是j个数字,都大于0。另一种是有0,即不够划分j个,用0来凑的。     j个数字中存在0的,其实就是前一个划分j-1的方案数,补0就行,即dp[i][j-1]。   ...

2018-03-27 20:01:22 1667 2

原创 Codeforces Round #470 (rated, Div. 2, based on VK Cup 2018 Round 1) C. Producing Snow

C. Producing SnowAlice likes snow a lot! Unfortunately, this year's winter is already over, and she can't expect to have any more of it. Bob has thus bought her a gift — a large snow maker. He plans t...

2018-03-11 21:13:08 248

原创 Codeforces Round #470 (rated, Div. 2, based on VK Cup 2018 Round 1) A. Protect Sheep

A. Protect SheepBob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his ...

2018-03-11 20:52:36 248

原创 Codeforces Round #466 (Div. 2) C. Phone Numbers

C. Phone NumbersAnd where the are the phone numbers?You are given a string s consisting of lowercase English letters and an integer k. Find the lexicographically smallest string t of length k, such th...

2018-03-10 20:02:41 179

原创 Codeforces Round #469 (Div. 2) C. Zebras

C. ZebrasOleg writes down the history of the days he lived. For each day he decides if it was good or bad. Oleg calls a non-empty sequence of days a zebra, if it starts with a bad day, ends with a bad...

2018-03-10 14:04:56 139

原创 Codeforces Round #469 (Div. 2) B. Intercepted Message

B. Intercepted MessageHacker Zhorik wants to decipher two secret messages he intercepted yesterday. Yeah message is a sequence of encrypted blocks, each of them consists of several bytes of informatio...

2018-03-10 13:28:02 629

空空如也

空空如也

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

TA关注的人

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