Luogu P3374 [template] tree array 1 (CDQ divide and conquer)

Title Description For example, if you know a sequence, you need to do the following two operations: 1. Add a number to x 2. Find the sum of each number in a certain interval I / O format Input format:   The first row contains two integers, N and M, which respectively represent the number of numbers and the total number of operations in t ...

Posted on Sun, 31 May 2020 10:01:32 -0700 by MNSarahG

Learning C language [8] looking for single dog

Only two numbers in an array appear once, and all other numbers appear twice. Write a function to find the two numbers that only appear once. LeetCode: Once only numbers, title links Example Input: [1,2,3,4,5,2,1,3] Output: 4, 5 Method 1: sort the array first, and then compare the adjacent numbers to see if they are the same. Figure: #inclu ...

Posted on Sat, 09 May 2020 08:15:09 -0700 by sholtzrevtek

C + + implementation of Huffman coding and decoding: building Huffman tree, coding and decoding Huffman

Recently completed the course design of data structure, and was assigned the title of Huffman coding and decoding. Now share your achievements in this blog. When I was designing, I referred to the algorithm and code of many teachers and predecessors on the Internet, and thanked them! Their achievements have given me a lot of inspiration and hel ...

Posted on Mon, 04 May 2020 21:59:45 -0700 by welsh_sponger

Personal Competition, April 19, 2020

A - Buggy Sorting Title: This title is to give you an incorrect sorting method, which requires you to determine if there is a correct running result.If the correct result exists, then output-1, otherwise output an example illustration is wrong.The input to the title is the number n of elements. Question: This is an interesting question and it i ...

Posted on Thu, 23 Apr 2020 09:34:04 -0700 by nepeaNMedia

freecplus framework MySQL database 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 use of connection and sqlstatement classes to operate MySQL database in freecplus framework. The declaration file of the class is f ...

Posted on Mon, 20 Apr 2020 09:34:46 -0700 by dkoolgeek

Luogu P3809 [template] suffix sorting

Background of topic This is a template problem. Title Description Read in a string composed of upper and lower case letters or numbers with a length of nn. Please sort all non empty suffixes of this string in dictionary order from small to large, and then output the position of the first character of the suffix in the original string in sequ ...

Posted on Sun, 19 Apr 2020 09:00:22 -0700 by plautzer

UCF Local Programming Contest 2017, 10 April 2020

A. Electric Bill Topic: This is a simple question, equivalent to the group function of an elementary school Calculating Electricity costs. Question: Check in the question. Code: #include<iostream> #include<cstring> #include<algorithm> #define ll long long using namespace std; int main(){ int F,E; int n; cin>&gt ...

Posted on Thu, 09 Apr 2020 18:45:35 -0700 by Liam-PHP

Chapter VIII standard template library STL

Catalog Class string STL container Basic concepts type Member function iterator Algorithm (function template) vector deque list less and greater function objects Class string Prototype: typedef basic_string < char > string; Common operation //Initialization string s1("Hello world!"),s2="Test",s3(8,'x'),s4; //String representing ...

Posted on Sun, 05 Apr 2020 10:13:12 -0700 by Axem

Chapter 7 2. Generic programming (template)

Catalog Function template Class template Class template and derivation Class templates and friends static member in class template Function: improve program reusability and generate corresponding functions automatically when the program is compiled Class and typename in the type parameter table of function template and class template can be ...

Posted on Sun, 05 Apr 2020 03:25:36 -0700 by AffApprentice

Chapter 7 1. Input / output and template

Catalog I / O stream Flow operator** File read write [^ 1] I / O stream I / O class derivation Standard flow object Standard input stream: cin -- connected to standard input device, istream object Standard output stream: cout -- connected to standard output device, ostream objectcerr -- connected to standard error output device (no buf ...

Posted on Sat, 04 Apr 2020 01:54:31 -0700 by fallen00sniper