Backpack problem V3 51Nod

... very naked score planning two points answer is converted as follows sum(pi)/sum(wi)=ans? => sum(pi)=ans*sum(wi)? => sum(pi-ans*wi)=0? discovers that ans has dichotomy If ans is too small then sum(pi-ans*wi) will be less than 0 二分出ans After pi-ans*wi ascending order, take the top k...


Finals [Online Mirror, Div. 2] A. AI robots

... to consider how to know if two robots can see each other. We can sort the robots from big to small, then use a line segment tree to record whether the i-th node has a robot, so we can know through the interval query of the line segment tree. For the i-th robot, how much can it see?...


Questions about the C language fgets function There are several functions that are input from the keyboard in the

... C language, and fgets is one of them. Today I also encountered a problem when writing code with the fgets function: the program does not block after the first call to the fgets function, but outputs an Enter key. When the fgets function is encountered for the second time, the program...


C++ rookie study notes series (6) - simple header file preparation

... C++ rookie study notes series (6) - simple header file preparation 在上上博客C++菜鸟Some of the ways to create your own data types in C++ have been described in the study notes series (5), but one problem that comes with it is that we often have to work in other files after creating a custom...


The stack application reverses the Polish expression

... 反波兰式式 反逆式expression is also called the suffix expression. In a typical expression, a binary operator is always placed between two operands associated with it, and this notation is also called an infix representation. In 1929, the Polish logician J. Lukasiewicz proposed another method...


0926-Tarjan shrink point - spy network (luogu P1262)

... 传门 分析 It is obvious that this question is related to the degree of the node. If the entry degree of a point is 0, then we must bribe him. But if you simply consider the degree, it is wrong. We ignore a case where the degree of entry is all greater than 0 - the ring. The example is an...


C++: Looking for the number with the highest probability of the two-color ball

... There are too many pre-codes, plus this will be written in C++, so I will open another one. There is no completeness, but you can convince yourself to write a point code and extract the numbers with the highest probability of occurrence of several two-color balls. It is also convenient...


The LDLT solution of the finite element one-dimensional variable bandwidth storage stiffness equation is implemented in C++ (1)

... In the finite element program, the stiffness equation [K] is established, and the nodal force vector F is processed by the non-homogeneous boundary condition. After the equivalent nodal force is processed, all of them become known. At this point, the F=KD equations can be solved to find...


LeetCode 69.Sqrt(x) (square root of x)

... title description: implementation int sqrt(int x) function. calculates and returns the square root of x , where x is a non-negative integer. Since the return type is an integer, the result only retains the part of the integer, and the fractional part will be discarded. 样1: 输入: 4 出出: 2 样...


LeetCode 67.Add Binary

... 题描述: gives two binary strings, returning their sum (in binary). 输入为 非空 String and only contains the numbers 1 and 0 。 example 1: 输入: a = "11 ", b = "1" output: "100" example 2: 输入: a = "1010", b = "1011" Output: "10101" AC C++ Solution: class Solution { Public: String addBinary(string a...