- 博客(82)
- 收藏
- 关注
原创 840C. Phone Numbers(贪心)
And 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 that its set of le...
2018-02-26 20:29:33 328
原创 A - TOYS (点与线段的位置关系 )
Calculate the number of toys that land in each bin of a partitioned toy box. Mom and dad have a problem - their child John never puts his toys away when he is f...
2018-02-26 15:58:18 214
原创 911C. Three Garlands(思维)
Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mishka will switch these garlands on.When a garland is switched on, it periodica...
2018-02-26 12:49:58 851
原创 B. Two Cakes(思维+暴力)
It's New Year's Eve soon, so Ivan decided it's high time he started setting the table. Ivan has bought two cakes and cut them into pieces: the first cake has been cut into a pieces, and the second one...
2018-02-26 11:52:31 1159
原创 911A. Nearest Minimums(暴力+思维)
You are given an array of n integer numbers a0, a1, ..., an - 1. Find the distance between two closest (nearest) minimums in it. It is guaranteed that in the array a minimum occurs at least two times....
2018-02-26 10:29:03 393
原创 浅谈 %*c 的用法
在一次偶然的机会接触到了%*c ,整理了这篇博文,希望能给大家带来帮助,如果大家有不同的借鉴,希望能够加以评论- - - - - - - - - - - - - - - - - - 正题分割线- - - - - - - - - - - - - - - - - - - - - - 用在scanf中的格式符号,%d 是很常见的输入一个整形数据,并存在一个整形变量中%*c 带有 * 表示忽略,在输...
2018-02-25 16:54:04 4072 1
原创 字符串替换
描述 编写一个程序实现将字符串中的所有"you"替换成"we"输入输入包含多行数据 每行数据是一个字符串,长度不超过1000 数据以EOF结束输出对于输入的每一行,输出替换后的字符串样例输入 you are what you do 样例输出 we are what we do #include<bits/stdc...
2018-02-25 16:26:43 161
原创 940B. Our Tanya is Crying Out Loud(思维)
Right now she actually isn't. But she will be, if you don't solve this problem.You are given integers n, k, A and B. There is a number x, which is initially equal to n. You are allowed to perform two ...
2018-02-25 11:16:10 565
原创 940A. Points on the line(思维逆向)
We've got no test cases. A big olympiad is coming up. But the problemsetters' number one priority should be adding another problem to the round. The diameter of a multiset of points on the line is the...
2018-02-25 10:47:07 492
原创 913A. Modular Exponentiation(思维)
The following problem is well-known: given integers n and m, calculate , where 2n = 2·2·...·2 (n factors), and denotes the remainder of division of x by y.You are asked to solve the "reverse" problem...
2018-02-24 17:03:37 255
原创 String painter (区间dp)
There are two strings A and B with equal length. Both strings are made up of lower case letters. Now you have a powerful string painter. With the help of the painter, you can change a segment of cha...
2018-02-24 10:38:32 219
原创 Bash and a Tough Math Puzzle
Bash likes playing with arrays. He has an array a1, a2, ... an of n integers. He likes to guess the greatest common divisor (gcd) of different segments of the array. Of course, sometimes the guess is ...
2018-02-23 20:07:52 217
原创 914B. Conan and Agasa play a Card Game(博弈)
Edogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number ai written on it.They t...
2018-02-23 17:44:16 580
原创 914A. Perfect Squares
Given an array a1, a2, ..., an of n integers, find the largest number in the array that is not a perfect square.A number x is said to be a perfect square if there exists an integer y such that x = y2....
2018-02-23 17:03:27 205
原创 939D. Love Rescue( 并查集 )
Valya and Tolya are an ideal pair, but they quarrel sometimes. Recently, Valya took offense at her boyfriend because he came to her in t-shirt with lettering that differs from lettering on her pullove...
2018-02-23 16:42:33 295
原创 A Simple Problem with Integers(区间更新+区间查询)
You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is to...
2018-02-21 20:50:31 559
原创 915D. Almost Acyclic Graph( 拓扑排序判环)
You are given a directed graph consisting of n vertices and m edges (each edge is directed, so it can be traversed in only one direction). You are allowed to remove at most one edge from it.Can you ma...
2018-02-21 11:00:17 243
原创 915B. Browser
Luba is surfing the Internet. She currently has n opened tabs in her browser, indexed from 1 to n from left to right. The mouse cursor is currently located at the pos-th tab. Luba needs to use the tab...
2018-02-21 09:44:16 256
原创 935B. Fafa and the Gates
Two neighboring kingdoms decided to build a wall between them with some gates to enable the citizens to go from one kingdom to another. Each time a citizen passes through a gate, he has to pay one sil...
2018-02-20 18:18:28 376
原创 A. Fafa and his Company
Fafa owns a company that works on huge projects. There are n employees in Fafa's company. Whenever the company has a new project to start working on, Fafa has to divide the tasks of this project among...
2018-02-20 17:57:07 439
原创 Multiplication Puzzle (区间dp)
The multiplication puzzle is played with a row of cards, each containing a single positive integer. During the move player takes one card out of the row and scores the number of points eq...
2018-02-20 17:13:55 361
原创 Brackets (区间dp)
We give the following inductive definition of a “regular brackets” sequence: the empty sequence is a regular brackets sequence,if s is a regular brackets sequence, then (s) and [s]...
2018-02-20 16:26:21 293
原创 938D. Buy a Ticket (SPFA)
Musicians of a popular band "Flayer" have announced that they are going to "make their exit" with a world tour. Of course, they will visit Berland as well.There are n cities in Berland. People can tra...
2018-02-20 11:51:00 611 1
原创 938C. Constructing Tests
Let's denote a m-free matrix as a binary (that is, consisting of only 1's and 0's) matrix such that every square submatrix of size m × m of this matrix contains at least one zero. Consider the followi...
2018-02-20 10:01:14 501
原创 A. Palindromic Supersequence
You are given a string A. Find a string B, where B is a palindrome and A is a subsequence of B.A subsequence of a string is a string that can be derived from it by deleting some (not necessarily conse...
2018-02-19 10:48:11 443
原创 932B. Recursive Queries
Let us define two functions f and g on positive integer numbers. You need to process Q queries. In each query, you will be given three integers l, r and k. You need to print the number of integers x ...
2018-02-19 10:35:26 614
原创 939C. Convenient For Everybody( 滑动窗口)
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are us...
2018-02-19 09:44:31 899
原创 B. Run For Your Prize
You and your friend are participating in a TV show "Run For Your Prize".At the start of the show n prizes are located on a straight line. i-th prize is located at position ai. Positions of all prizes ...
2018-02-18 15:57:51 366
原创 A. Word Correction
Victor tries to write his own text editor, with word correction included. However, the rules of word correction are really strange.Victor thinks that if a word contains two consecutive vowels, then it...
2018-02-18 10:48:41 548
原创 A. Love Triangle
As you could know there are no male planes nor female planes. However, each plane on Earth likes some other plane. There are n planes on Earth, numbered from 1 to n, and the plane with number i likes ...
2018-02-18 09:30:39 332
原创 939B. Hamster Farm
Dima has a hamsters farm. Soon N hamsters will grow up on it and Dima will sell them in a city nearby.Hamsters should be transported in boxes. If some box is not completely full, the hamsters in it ar...
2018-02-18 09:14:03 640
原创 934 C. A Twisty Movement
A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a flying d...
2018-02-17 10:57:20 329
原创 934A. A Compatible Pair
Nian is a monster which lives deep in the oceans. Once a year, it shows up on the land, devouring livestock and even people. In order to keep the monster away, people fill their villages with red colo...
2018-02-17 10:18:02 356
原创 934B. A Prosperous Lot
Apart from Nian, there is a daemon named Sui, which terrifies children and causes them to become sick. Parents give their children money wrapped in red packets and put them under the pillow, so that w...
2018-02-14 22:36:07 493 4
原创 916C. Jamie and Interesting Graph(构图+思维)
Jamie has recently found undirected weighted graphs with the following properties very interesting: The graph is connected and contains exactly n vertices and m edges. All edge weights are integers a...
2018-02-14 19:06:14 499
转载 Tarjan算法详解
割点的概念 转载:点击打开链接在无向连通图中,如果将其中一个点以及所有连接该点的边去掉,图就不再连通,那么这个点就叫做割点(cut vertex / articulation point)。 例如,在下图中,0、3是割点,因为将0和3中任意一个去掉之后,图就不再连通。如果去掉0,则图被分成1、2和3、4两个连通分量;如果去掉3,则图被分成0、1、2和4两个连通分量。 怎么求割点 直接DFS 最容...
2018-02-14 11:34:58 269
原创 Jamie and Alarm Snooze(暴力+思维)
Jamie loves sleeping. One day, he decides that he needs to wake up at exactly hh: mm. However, he hates waking up, so he wants to make waking up less painful by setting the alarm at a lucky time. He w...
2018-02-14 10:54:31 291
原创 B. Radio Station
As the guys fried the radio station facilities, the school principal gave them tasks as a punishment. Dustin's task was to add comments to nginx configuration for school's website. The school has n se...
2018-02-13 23:29:54 450
原创 918A. Eleven
Eleven wants to choose a new name for herself. As a bunch of geeks, her friends suggested an algorithm to choose a name for her. Eleven wants her name to have exactly n characters. Her friend suggest...
2018-02-13 23:01:46 256
原创 919D. Substring(拓扑排序+dp)
You are given a graph with n nodes and m directed edges. One lowercase letter is assigned to each node. We define a path's value as the number of the most frequently occurring letter. For example, if ...
2018-02-13 22:29:45 299
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人