Blue Bridge Cup prime
Title 1525: Blue Bridge Cup algorithm to improve VIP prime
time limit: 1Sec Memory limit: 128MB Submit: 2503 solve: 347
Title Description
Given interval[L, R] , Please calculate the number of primes in the interval.
input
Two numbers L and R.
Data scale and agreement
2 < = L < = R < = 2147483647
R-L < = ...
Added by Johannes80 on Fri, 11 Feb 2022 04:02:33 +0200
[Blue Lake special session] the 241st weekly match of Li Kou
I went to bed late last night. I went to bed at 4 o'clock and got up at 10 o'clock to play the game
Question 1: 5759 Find the XOR sum of all subsets and then sum
Title Link
5759. Find the XOR sum of all subsets and sum again
Topic introduction
Topic idea
Directly find the number of subsets, and then XOR each subset, and finally su ...
Added by pavanpuligandla on Thu, 10 Feb 2022 22:59:49 +0200
Summary of advanced graph theory algorithms (LCA, strong (double) connected components, Euler path and Euler loop, topological sorting, 01 planning) - acwing algorithm improves acm
The basic graph theory algorithms are summarized here:
Summary of basic graph theory algorithms (shortest path, minimum spanning tree, bipartite graph)
LCA
Upward marking method
Time complexity
O
(
n
∗
m
...
Added by Crave on Thu, 10 Feb 2022 22:51:46 +0200
Sorting algorithm and binary search algorithm
1. Bubble sorting
Bubble sorting principle:
1) Compare two adjacent elements. If the preceding element is larger than the following element, exchange the two numbers. After the first traversal, the maximum number will be placed at the last position of the array, that is, array[length - 1]. 2) The last element is skipped during the second trav ...
Added by blindtoad on Thu, 10 Feb 2022 22:27:00 +0200
Classic sorting algorithm of Java
1, Bubble sorting
1. Algorithm idea:
Compare adjacent elements. If the first is larger than the second, exchange the two elements.Start from the first element and then compare the two adjacent elements successively until the last one is compared, so that the last element is the largest element.Again, start from the first element and compare t ...
Added by ifm1989 on Thu, 10 Feb 2022 19:30:09 +0200
Heap, comparator, cardinality sort
1, Heap and related operations
Heap structure is a complete binary tree structure implemented by array size refers to the number of nodes I position, left child 2i+1, right child 2i+2, parent node (i-1)/2 rounded downIn a complete binary tree, if the maximum value of each subtree is at the top, it is a large root heapIn a complete binary t ...
Added by wee493 on Thu, 10 Feb 2022 16:49:47 +0200
Leecode421: Maximum XOR value of two numbers in an array
Give you an array of integers, nums, and return the maximum result of nums[i] XOR nums[j]. Where 0<=i<=j<n
Tips: 1 <= nums.length <= 2 * 104 0 <= nums[i] <= 231 - 1
Example 1:
Input: nums = [3,10,5,25,2,8] Output: 28 Interpretation: The maximum result of the operation is 5 XOR 25 = 28.
Example 2:
Input: nums = ...
Added by hansman on Thu, 10 Feb 2022 14:21:13 +0200
Solutions to group C/C++A questions of the 11th Blue Bridge Cup in 2020 (excluding the last two questions)
A house plate making
Title Description
Calculate the number of characters 2 from 1 to 2020.
thinking
The amount of data is very small, direct violence, and the number of 2 can be counted for each number.
code
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int ans = 0;
for (int i = 1; i <= 2020; i ...
Added by sbinkerd1 on Thu, 10 Feb 2022 13:55:01 +0200
Note | statistical learning method: Decision Tree
Basic concepts of decision tree
Decision tree is a tree.
The leaf node corresponds to the decision result, and each other node corresponds to an attribute test;The sample set contained in each node is divided into sub nodes according to the results of attribute test;The root node contains the complete set of samples, and the path from the roo ...
Added by catlover on Thu, 10 Feb 2022 12:46:58 +0200
Sword finger offer related exercises (3 ~ 10)
catalogue
Title: Sword finger offer03: repeated numbers in the array
Title: Sword finger offer04: search in two-dimensional array
Title: Sword finger offer05: replace spaces
Title: Sword finger offer06: print linked list node information from end to end
Title: Sword finger offer07: reconstruction of binary tree (pre order + middle order)
...
Added by Fusioned on Thu, 10 Feb 2022 12:33:27 +0200