Generating random numbers and corresponding boxing guessing games
I. Introduction
In c + +, the common way to generate random numbers is to call the srand() and rand() functions. It is worth noting that the random number "generated" in all programs is actually a pseudo-random number, which is essentially a set of unordered numerical sequences stored in the computer.
Therefore, when initializing the ...
Posted by FoTo50 on Tue, 31 Dec 2019 22:08:07 -0800
NOIP2000 improvement group T3 word connection
Problem surface
Word Solitaire is a game similar to the idiom Solitaire we often play. Now we know a group of words, and given an initial letter, we need to give the longest "dragon" that starts with this letter (each word appears twice in the "dragon" at most). When two words are connected, their overlapping parts are comb ...
Posted by jstone3503 on Tue, 31 Dec 2019 20:52:14 -0800
ZRDay6A. Newly demolished tower (ternary pressure dp)
meaning of the title
Sol
It's like the first time I've been exposed to ternary pressure
First of all, it's not necessarily the best to eat gems after each fight, because there are imitation monsters, maybe you can hit GG after you finish eating gems with him..
So there are three states that we need to maintain
0: no fight
1: I beat ...
Posted by pillot1005 on Tue, 31 Dec 2019 02:30:20 -0800
Analysis of c/c++ lambda expression
Analysis of lambda expression
Big premise: capture the timing of variables in the list.
There is a difference between the capture list and the parameter list. The variables in the capture list are determined at the time of capture, not at the time of lambda call. The parameter list is determined at the time of call. So when I capture an int i ...
Posted by markmil2002 on Mon, 30 Dec 2019 12:14:05 -0800
Lead sets
meaning of the title
Title Link
Give a tree, delete some edges, so that the distance between any point in any connected block is less than $k$
sol
The greedy thought in the examination room is right: consider a subtree. If the distance between the deepest two nodes in the subtree is added $> k $, the deepest point will be deleted. When u ...
Posted by binarynomad on Mon, 30 Dec 2019 11:33:36 -0800
Detailed explanation of bind function of c/c + + standard library
Detailed explanation of bind function of standard library
bind function: receive a function name as a parameter to generate a new function.
auto newCallable = bind(callbale, arg_list);
Arg list may contain parameters such as 1, 2, etc., which are parameters of the new function newCallable.
In this blog Introduction to lambda expression In, ...
Posted by matt2012 on Sun, 29 Dec 2019 07:07:54 -0800
Global Warming (BlueBridge Cup April 18th)
Global warming
You have a picture of a sea area with NxN pixels, "." for ocean, "#" for land, as shown below:
....##....##......##....####....###....
An island is made of land connected in all four directions.For example, there are two islands in the picture above.
Because global warming is causing sea level rise, scientists ...
Posted by gabeg on Fri, 27 Dec 2019 12:38:30 -0800
c/c + + standard library map set insertion
Standard library map set insertion
1, Insert operation
The map is as follows:
map<string, size_t> cnt;
Insert method:
Insert operation type
Function description
cnt.insert({"abc", 12});
Use braces directly
cnt.insert(make_pari("abc", 22));
Return a pair with the make u pair function
cnt.insert(pair<string, size_t>("abc", 22 ...
Posted by serbestgezer on Fri, 27 Dec 2019 09:53:01 -0800
[beginner to Daniel Road 11] port management optimization of switch background management
Project requirements
Project 10 uses port1,port2,port3,port4,prot5, and set port1, set port2, set port3, set port4, set port5 to manage five ports. The code is bloated and repetitive, which is not easy to maintain.
Solution:Use an array of structs.
Project realization
Modification:
//Five port variables are defined
//struct port por ...
Posted by Morbius on Thu, 26 Dec 2019 23:35:34 -0800
Delete map set of c/c + + standard library
Standard library map set delete
Delete operation
The map is as follows:
map<int, size_t> cnt{{2,22}, {3,33}, {1,11}, {4,44};
Delete method:
Delete operation type
Function description
cnt.erase(3);
Delete the element with key 3 and return the number of deleted elements
cnt.erase(p);
P is the iterator, delete the element pointed by P ...
Posted by bigfunkychief on Thu, 26 Dec 2019 12:00:24 -0800