lower_bound () 和 upper_bound () 在从大到小数组中的使用
今天突发奇想,想知道 lower_bound()
和 upper_bound()
函数在从大到小的数组中怎么使用,猜想 C++ 中应该会有重载, 果不其然, 正确打开姿势是酱紫。
1 | lower_bound(begin, end, val, greater<T>()) |
今天突发奇想,想知道 lower_bound()
和 upper_bound()
函数在从大到小的数组中怎么使用,猜想 C++ 中应该会有重载, 果不其然, 正确打开姿势是酱紫。
1 | lower_bound(begin, end, val, greater<T>()) |
发现了一个好玩的东东
传送门:Dungeon Master
人一我百!人十我万!永不放弃~~~怀着自信的心,去追逐梦想 ——kuangbin
You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit north, south, east, west, up or down. You cannot move diagonally and the maze is surrounded by solid rock on all sides.
Is an escape possible? If yes, how long will it take?
传送门: 2018 牛客网暑期 ACM 多样训练营(第五场)A gpa
At the university where she attended, the final score of her is ${\sum{s[i]c[i]} \over \sum{s[i]}}$
Now she can delete at most k courses and she want to know what the highest final score that can get.
Polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev got hold of lots of wooden cubes somewhere. They started making cube towers by placing the cubes one on top of the other. They defined multiple towers standing in a line as a wall. A wall can consist of towers of different heights.
Ivan wants to write a letter to his friend. The letter is a string s consisting of lowercase Latin letters.
Unfortunately, when Ivan started writing the letter, he realised that it is very long and writing the whole letter may take extremely long time. So he wants to write the compressed version of string s instead of the string itself.
Arseniy is already grown-up and independent. His mother decided to leave him alone for m days and left on a vacation. She have prepared a lot of food, left some money and washed all Arseniy’s clothes.
A permutation of size n is an array of size n such that each integer from 1 to n occurs exactly once in this array. An inversion in a permutation p is a pair of indices (i, j) such that i > j and a**i < *a**j*. For example, a permutation [4, 1, 3, 2] contains 4 inversions: (2, 1), (3, 1), (4, 1), (4, 3).
Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).