[HNOI2002] - Luogu 2234 - turnover statistics - tree
First exercise blog!!
This question is relatively simple.
The question is to input a sequence.
Every time you insert one, find the value that has the smallest difference with the previous one, and add their difference into the answer.
You can think of the balance tree here.
Every time you input it, add it to the tree, then find its precursor an ...
Posted by kalebaustin on Fri, 01 May 2020 08:21:37 -0700
Inversion of Mobius
Write in front
This is the first time konjaku has written such a long blog
\(gyh\ nb\),\(\text{OI-Wiki}\ nb\)
If you think it's OK to write, please click support \ (qwq \)
Prior knowledge
Product function,Dirichlet convolution,Number theory is divided into parts (go to gyh for this article, I can't talk about it well) (make up slowly when you ...
Posted by jmr3460 on Tue, 28 Apr 2020 21:28:32 -0700
Note 6: array of compound types
What is an array
An array is an ordered sequence of elements, a collection used to store data of the same type.
Definition of array
1. Declaration formula (one dimension)
1. Static array
typeName arrayName[arraySize];
2. Dynamic array
typeName* arrayName = new typeName[arraySize];
2. Explanation of array terms
Array name
There will be a set n ...
Posted by SlimSlyk on Fri, 24 Apr 2020 09:41:27 -0700
freecplus framework - log file operation
1, Source code description
Freecplus is a C/C + + open source framework under Linux system. Please go to the C language technology network (www.freecplus.net) to download the source code.
This paper introduces the method of log file operation in freecplus framework.
The declaration file for functions and classes is freecplus / 65124; freecplus ...
Posted by Kardall on Mon, 20 Apr 2020 10:56:26 -0700
CreateEvent process synchronization
CreateEvent inter process synchronization
CreateEvent can create or open a named or unnamed event object.
HANDLE CreateEvent(
LPSECURITY_ATTRIBUTES lpEventAttributes, // pointer to security attributes
BOOL bManualReset, // flag for manual-reset event
BOOL bInitialState, // flag for initial state
LPCTSTR lpName // pointer to event-objec ...
Posted by Oaquasis on Sun, 19 Apr 2020 09:42:44 -0700
CSP201412-1: access control system
Introduction: CSP (http://www.cspro.org/lead/application/ccf/login.jsp) It is a "computer professional qualification certification" examination initiated by China Computer Society (CCF), aiming at the ability certification of professionals in computer software development, software testing, information management and other fields. Cer ...
Posted by er0x on Sun, 19 Apr 2020 08:07:10 -0700
Lougu P1586 Quadrilateral Theorem
Title Description
The tetragonal theorem is well known: any positive integer NN can be decomposed into the sum of squares of no more than four integers.For example: 25=1^{2}+2^{2}+2^{2}+2^{2}+4^{2}25=12+22+42, and of course there are other decomposition schemes, 25=4^{2}+3^{2}25=42+32 and 25=5^{2}25=52.Given a positive integer nn, the program ...
Posted by melissal on Fri, 10 Apr 2020 09:42:42 -0700
Find the median of two ordered arrays
If we use the algorithm with time complexity O (m+n), it will be very simple. Today we will introduce an algorithm with time complexity O (log(m+n)).
Here we use the idea of dichotomy to solve this problem. First, the array we give is two ordered arrays. In this way, we can easily divide the two arrays into two parts, and the median we are look ...
Posted by jaymoore_299 on Thu, 09 Apr 2020 07:38:09 -0700
C + + virtual inheritance
Suppose we have class A, class B and class Test. Class Test has all the attributes of class A and class B, and they all have the temp attribute. Now we need to set and read the temp attribute in class Test, so write the following program:
#include <iostream>
class Base{
public:
int temp;
};
class A : public Base{
};
class B : publi ...
Posted by Japet on Mon, 06 Apr 2020 10:45:40 -0700
Luogu T21778 New Year
Title Description
There are n(1 \leq n \leq 10^5)n(1 ≤ n ≤ 105) children. They will give m(1 \leq m \leq 10^5)m(1 ≤ m ≤ 105) gifts for the new year.
Each time, three parameters L, r, k (1 \ Leq L \ Leq r \ Leq n,1 \ Leq k \ Leq 10 ^ 5) l, r, k (1 ≤ L ≤ r ≤ n,1 ≤ k ≤ 105) will be given, indicating that a gift kk will ...
Posted by Miker on Mon, 06 Apr 2020 07:58:40 -0700