A few written questions

xiaoxiao2021-03-05  24

First, there are 1000 identical apples, and now put 10 identical boxes, ask each box to be empty, ask several ways?

Second, nine people and a monkey up the mountain adventure, but the dry food is finished, they took a pile of wild fruit, and then divided the pile of wild fruit into nine copies. After one, I will eat it. One of them happened to others when others were not there, then the remaining eight parts were divided into nine copies, and after another, I gave monkey. The second person is also the case. He took the first person to the nine-in-one, and divided the rest of nine, and went there again, and he also gave monkey. Nine people, this is nine, and each time has a lot of money. How many people are there?

Third, write the following functions as required. Function: Moving # characters in the given buffer to string tail function name: ChangeTotail entry parameter: PSZ pointing to the pointer of the buffer, the nsize buffer length exit: PSZ refers to # characters in the buffer in the buffer to the buffer Tail return value: In the first # of the exit buffer, if there is no # characters in the buffer, return -1 description: If it is incoming (# w # w # ww #, 10), it should be Convert to wwwww ##### and return value 5

Fourth, there are nine rings, each ring has "upper", "under" two states, "∧" and "∨". At the beginning, nine average is "upper" state, namely: ∧9 ∧8∧7∧6 ∧5∧4∧3∧2∧1. Suppose we have to change the status of the i-th ring (∧i -> ∨i or ∨i -> ∧i), you must satisfy ∧∧-1∨i-2 ... ∨1. That is, there is only the first ring to the upper state, and the other in its front ring (1-> I-2) is the state of the I ring can be changed. The nine are now "upper" state, change to nine all as "lower", ask at least how many steps need to operate (change to any one ring under condition license is called one step)?

Fifth, two people carry a table tennis competition, who will win 21 balls, and win the number of people at least more than 2 balls, then who will win. Suppose now is now win 3 goals, B wins 4 goals, how much is it? The difference between the two people did not consider the difference between the ball and the ball.

Sixth, in the network implementation of the operating system, there is such a case, when the user uses the TCP protocol Send a packet, the operating system first get the data part, followed by TCP header, IP header, data link head. All of these data make up an Ethernet to send out the network card, and because the size of the TCP header, IP header, and ETH heads cannot be expected, the space cannot be reserved at Send. The problem is that in the computer, the data copy is a relatively slow process. If you add a protocol head, you need COPY once, the efficiency of Send is very low, please design a data structure, which is convenient to the front of the data. Add some data, which can be easily removed from all data.

转载请注明原文地址:https://www.9cbs.com/read-35355.html

New Post(0)