LeetCode 445 -- sum of two numbers II
1. topic
2. answers
2.1 method 1
stay LeetCode 206 - reverse linked list and LeetCode 2 -- sum of two numbers On the basis of this, we first reverse the two linked lists, then find the sum and then reverse them.
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x) ...
Added by Devsense on Mon, 02 Dec 2019 07:04:51 +0200
Luogu P3600 random number generator (expected dp combination number)
meaning of the title
Title Link
Sol
An important property: if an interval covers another interval, then the interval is useless (it will not contribute to the maximum value)
First, it's not hard to think of enumerating the final answer \ (x \). At this time, we need to calculate the probability that the maximum value is exactly \ (x \).
It's no ...
Added by student101 on Sun, 01 Dec 2019 12:38:20 +0200
c/c + + inheritance and polymorphic container and inheritance 1
Question: Class B inherits class A, class A has virtual function fun, class B covers virtual function fun, and has a STD:: vector < a >. Add object a and object B of a to this container, and then take them out of vector. What happens if you use object a.fun() and object b.fun()?
Find the call of object b.fun(), which actually calls the fu ...
Added by rage2021 on Sun, 01 Dec 2019 10:45:07 +0200
Using cuda core in open CV CPP
Prerequisite
Install the Invida graphics card on your computer;
Install Invida driver, version recommendation is more than 10;
Install cuda and cudnn;
github downloads opencv, opencv_contribute; local cmake compiles opencv;
target
In cpp, use the cuda kernel function written by you;
Reasons for writing this article
Recently, I was writing cud ...
Added by ultraslacker on Fri, 22 Nov 2019 04:11:58 +0200
P1438 boring sequence (difference + line tree)
subject
P1438 boring sequence
Analysis:
First, consider the modification. Using the basic idea of difference, add the first item \ (k \) to the left endpoint, add the tolerance \ (D \) to the difference array of each number in the modification interval \ ((l,r] \), and then subtract \ (k + (R-L) times d \) from the last \ (r+1 \).
The query is ...
Added by rubenc on Thu, 21 Nov 2019 20:56:47 +0200
P2472 [SCOI2007] lizard (maximum flow)
subject
P2472 [SCOI2007] lizard
analysis
The idea of this problem is quite clear. In this paper, I ran the maximum flow with Jiu as my brain free map, but I hung up and rebuilt the map after an hour.
Build a super source and a super sink,
Every stone pillar has its fixed passing times, that is to say, we need to limit its passing times. How to ...
Added by huszi001 on Mon, 18 Nov 2019 21:03:28 +0200
NOIP 2011 Mayan game search
Topic link: https://www.luogu.org/problemnew/show/P1312
My first question solution!!
Of course, thanks. ZAGER , his link https://www.cnblogs.com/ZAGER/p/9535526.html
This question is a big search, which really tests my code ability
It's a good habit to write functions with clear ideas.
Step by step
Define map[i][j] to represent the cur ...
Added by Amitk on Fri, 15 Nov 2019 22:59:36 +0200
Arduino NRF24L01 application instance (32Bytes)
Application example of Arduino(NANO) NRF24L01
Software preparation:microBox Library( https://github.com/wastel7/microBox ): build a mini command line systemMirf Library ( https://github.com/E-elektronic/Mirf ): provide RF related core functionsPlease download the above library by yourself
Hardware preparation:Arduino NANO plate x 2; NRF24L01 x ...
Added by mwl707 on Sun, 10 Nov 2019 22:38:02 +0200
MFC bottom window implementation
Brief description
MFC is a basic class library of Microsoft. If GUI is developed on Windows platform, it is a good choice. Simply record the knowledge points that need to be mastered or viewed later in the learning process of MFC.
Windows Messaging
First, the operating system captures the messages from the keyboard or mouse input system, and ...
Added by Copyright on Fri, 18 Oct 2019 09:40:57 +0300
c + + shallow copy and its solution
Shallow copy: take string class as an example When copying a known object, the compiler will automatically call a constructor - copy constructor. If the user does not define a copy constructor, the default copy constructor will be called. The default copy structure belongs to the shallow copy, which is equivalent to two pointer variables poin ...
Added by ojav on Tue, 15 Oct 2019 17:51:21 +0300