1. You ask a worker to work for you for 7 days, and the reward for the worker is a gold bar. The gold bar is divided into 7 connected segments
. You must give them a segment of gold bar at the end of each day. If you are only allowed to break the gold bar twice, how can you give it to your workers? Pay?
2. Please cut a box of cake into 8 parts and distribute them to 8 people, but one part must be left in the cake box.
3. Xiao Ming’s family crossed a bridge. It was dark when they crossed the bridge, so there must be lights. Now it takes Xiao Ming 1 second to cross the bridge,
It takes Xiao Ming's brother 3 seconds, Xiao Ming's father takes 6 seconds, Xiao Ming's mother takes 8 seconds, and Xiao Ming's grandfather takes 12 seconds. At most
two people can cross this bridge at a time, and the speed of crossing the bridge depends on the slowest person crossing the bridge, and the lights will
go out 30 seconds after being lit. Question: How did Xiao Ming’s family cross the bridge?
4. A group of people had a dance, each wearing a hat on his head. There are only two kinds of hats, black and white, and there is at least one black one. Everyone can see the color of everyone else's hat, but not their own. The host first lets everyone see
what hat others are wearing, and then turns off the lights. If anyone thinks they are wearing a black hat, slap themselves
. When I turned off the lights for the first time, there was no sound. So I turned on the lights again and everyone watched it again. When I turned off the lights, there was still no sound. It wasn't until the lights were turned off for the third time that the sound of slaps could be heard. Ask how many people are wearing black
hats?
5. Please estimate the quality of the CN TOWER TV tower.
6. There is a diamond at the entrance of the elevator on each floor from the first floor to the tenth floor. The diamonds vary in size. You take the elevator
from the first floor to the tenth floor. The elevator door will open once on each floor, and you can only get the diamond once. How can you get the biggest one?
7. The U2 choir has to rush to the concert venue within 17 minutes. They must cross a bridge on the way. Four people start from the same end of the bridge
and you have to help them get there. On the other side, it was dark and they only had a flashlight. At most two people can cross the bridge at the same time. When crossing the bridge, you must hold a flashlight, so someone has to bring the flashlight to and from the bridge. end. Flashlights cannot be passed around by throwing them away. Four people walk at different speeds
If two people are walking together, the slower one will prevail. It takes Bono 1 minute to cross the bridge, Edge
2 minutes to cross, Adam 5 minutes to cross, and Larry 10 minutes to cross. How can they cross the bridge in 17 minutes?
8. It takes an hour to burn an uneven rope. How to use it to judge half an hour?
9. Why are the sewer covers round?
10. How many gas stations (cars) are there in the United States?
11. There are one 7-gram weight, one 2-gram weight, and one scale. How to use these items only three times to divide 140 grams of salt into 50 and 90 grams each? ?
12. A train leaves Los Angeles and goes straight to New York at a speed of 15 kilometers per hour, and another train leaves New York and goes to Los Angeles at a speed of 20 kilometers per hour.
If there is a bird with a speed of 30 kilometers per hour and
Two trains are currently started, departing from Los Angeles, meeting another car and returning, flying back and forth between the two trains in turn
Okay, two trains meet on the straight. How far did this little bird fly?
13. You have two jars, 50 red marbles and 50 blue marbles. Randomly select a jar and randomly
select a marble and put it into the jar. , how to give the red pinball the greatest chance of being selected? In your plan, what is the exact probability of getting
a red ball?
14. Imagine you are in front of a mirror. Please tell me, why can the image in the mirror be reversed left and right, but not up and down?
Up and down?
15. You have four jars filled with pills. Each pill has a certain weight. The contaminated pills are the weight of the pills that have not been
1. Weigh it only once. , how to determine which jar of medicine is contaminated?
16. If you have an infinite amount of water, a 3-quart bucket and a 5-quart pail, how do you accurately weigh
4 quarts of water?
17. You have a bucket of jelly, including yellow, green, and red. Close your eyes and select two of the same color.
Grab two of the same color. indivual. How many can you grab to make sure you have two jelly of the same color?
Jelly?
18. Insert the car key into the door and turn it in which direction to unlock the car?
19. If you could remove any of the 50 states, which one would you remove and why?
20. Perform the following operations on a batch of lights numbered 1 to 100 with all switches turned upward
For multiples of 1, turn the switch once in the opposite direction, and for multiples of 2, turn the switch in the opposite direction again. Switch once to multiples of 3 in the reverse direction
Flip the switch again.
Ask for the number of the last light that was turned off.
21. Suppose a disc rotates like a turntable on a record player. This disk is half black and half white
. Suppose you have an unlimited number of color sensors. How many color sensors would you need to
surround the disk to determine which direction it is turning? Where should they be placed?
22. Suppose the clock reaches 12 o'clock. Notice that the hour and minute hands overlap. How many times do the hour and minute hands overlap during the day?
***How ??many times do the hour and minute hands overlap? Do you know the exact time when they overlap?
23. Two odd numbers separated by only one digit are called odd number pairs, such as 17 and 19. Prove that the number between pairs of odd numbers
is always divisible by 6 (assuming both odd numbers are greater than 6). Now prove that there is no odd pair consisting of three odd numbers
.
24. A room has a door (the door is closed) and 3 lights. There are three switches outside the house, which are connected to the three lights. You can manipulate these switches at will, but once you open the door, you cannot change the switch.
Determine which light each switch controls.
25. Suppose you have 8 balls, one of which is slightly heavier, but the only way to find out which ball is
is to compare the two balls on a scale. What is the minimum number of weighing times required to find the heavier ball?
26. Let’s play a word splitting game, where the order of all letters is disrupted. You have to determine what this word is
.
Assume that the split word consists of 5 letters:
1. How many possible combinations are there?
2. What would happen if we knew which 5 letters they were?
3. Find a way to solve this problem.
27. Four women want to cross a bridge. They are all standing on a certain side of the bridge, and they must all pass through the bridge within 17 minutes. It was night. They only have a flashlight. At most two people can cross the bridge at the same time.
No matter who is crossing the bridge, whether alone or two people, they must carry a flashlight. The flashlight must be passed around
and cannot be thrown. Each woman crosses the bridge at a different speed, and the two people must cross the bridge at the slower speed of the slower one.
The first woman: it takes 1 minute to cross the bridge;
The second woman: it takes 2 minutes to cross the bridge;
The third woman: it takes 2 minutes to cross the bridge It takes 5 minutes;
The fourth woman: It takes 10 minutes to cross the bridge.
For example, if the first woman and the fourth woman cross the bridge first, by the time they pass, 10 minutes have passed.
If the fourth woman is asked to send the flashlight back, then by the time she reaches the other end of the bridge, it will take a total of 20 minutes and the operation will fail. How to get these 4 women to cross the bridge in 17 minutes? Is there any other way
?
28. If you have two buckets, one contains red paint and the other contains blue paint. You
take a cup from the blue paint bucket, pour it into the red paint bucket, and then take a cup from the red paint bucket and pour it into the blue paint bucket
. Which of the two buckets has a higher ratio of red and blue paint? Prove this arithmetically.
B: Crazy calculation
29. Given two numbers between 1 and 30, A knows the sum of the two numbers, and B knows the product of the two numbers.
A asked B: "Do you know which two numbers they are?" B said: "I don't know";
B asked A: "Do you know which two numbers they are? ? "A said: "I don't know either";
So, B said: "Then I understand";
Then A also said: "Then I understand too";
What are these two numbers?
30, 4, 4, 10, 10, addition, subtraction, multiplication and division, how to get 24 points?
31. 1000! How many digits are there and why?
32. F(n)=1 ngt; 8 nlt; 12
F(n)=2 nlt; 2
F(n)=3 n=6
F(n)=4 n=other
Use - * / and the sign(n) function to combine the F(n) function
sign(n)=0 n=0
sign(n)=-1 nlt; 0
sign(n)=1 ngt; 0
33 , write a program to find the sum of prime numbers, for example, F(7)=1 3 5 7 11 13 17=58
34.. . .
Please use only one pen to draw four straight lines to connect all the points in Figure 9
35. How many types of three-layer and four-layer binary trees are there
36. The sequence of numbers 1--100000 is arranged in a certain order. There is an error with one number. How to correct it? Write the best
method. What about two numbers?
37. What is the difference between a linked list and an array?
38. Why do you choose this method to make a linked table?
39. Choose an algorithm to sort out a linked list. Why did you choose this approach? Now it takes
O(n) time to do.
40. Talk about the advantages and disadvantages of various stock classification algorithms.
41. Use an algorithm to reverse the order of a linked list. Now do it again without recursion
.
42. Use an algorithm to insert a node into a circular linked list, but it must not traverse the linked list.
43. Use an algorithm to organize an array. Why did you choose this approach?
44. Use an algorithm to match universal strings.
45. Reverse a string to optimize speed and space.
46. Reverse the order of words in a sentence, such as converting "My name is Chrissy" to "Chrissy called me",
To achieve the fastest speed and move least.
47. Find a substring, optimize speed and space.
48. Comparing two strings takes O(n) time and constant space.
49. Suppose you have an array of 1001 integers. These integers are arranged arbitrarily, but you
know that all integers are between 1 and 1000 (including 1000) between. Additionally, except for one number that appears twice,
all other numbers appear only once. Suppose you can only process this array once and use an algorithm to find the duplicate number. If you use auxiliary storage in your operations, can you find an algorithm that doesn't use this method?
50. Increase 8 times without multiplication or addition. Now use the same method to increase it 7 times.
C: Creative application
51. Due to a work error, the salesperson mistakenly sold a laptop worth 20,000 yuan to Mr. Li for 12,000 yuan.
Why did Ms. Wang’s manager write to Mr. Li to try to get the money back?
52. How to apply computer technology to the elevator system of a 100-story office building? How
would you optimize this application? How will factors such as traffic, floor or time of day affect this?
53. How do you implement protective measures for an operating system that can be stored in files or copied from the Internet at any time to prevent illegal copying?
54. How would you redesign an ATM?
55. Suppose we want to operate a microwave oven through a computer. What kind of software would you develop to complete this task?
56. How do you design a coffee machine for a car?
56. If you wanted to add some content to Microsoft Word system, what kind of content would you add?
57. What kind of keyboard would you design for a user with only one hand?
58. What kind of alarm clock would you design for a deaf person?
Reference answers:
1. Day1 gives segment 1,
day2 asks workers to return segment 1 to segment 2,
day3 Give 1 paragraph,
day4 Return 1 2 paragraphs, give 4 paragraphs.
day5 and so on...
2. Faced with such a strange question, some applicants racked their brains and couldn't divide it; while some applicants felt
This question is actually very simple. Take out 7 portions of the 8-piece cake and give it to 7 people, and then give the remaining 1 portion to the 8th person together with the cake box
4. If only one person wears a black hat, then when he sees everyone wearing a white hat, he should slap himself when he turns off the lights for the first time, so there should be more than one One person wears a black hat; if there are two black hats, the first time both of them see the black hat on the other person's head, they are not sure of their own color, but the second time they turn off the lights , these two people should understand
that if they are wearing a white hat, then the other person should have slapped them long ago, so they are also wearing a black hat
, so they also There will be a slap in the face; but the fact that the slap was heard only for the third time means that there were more than two black hats in the audience. By analogy, it should be that the lights were turned off several times, and how many black hats were there? cap.
5. For example, how can you quickly estimate the height of the bracket and column, the radius of the ball, calculate the volume of each part, etc.
etc. The recruitment officer said: "As far as the CNTOWER question is concerned, it is different from general riddles or intelligence questions
. We call this type of question 'quick estimation question', and it mainly tests The ability to estimate quickly is one of the necessary abilities for developing software. Of course, the question is just a means, not an end. It is necessary to get a result in the end, but it is more important. The important thing is to examine the process by which the examinee reaches this result, that is, the method. "Mr Miller gave the reporter an example of a more reasonable answer. He first drew CN on the paper. TOWER's sketch, and then quickly
estimate the height of the bracket and each column, as well as the radius of the ball, calculate the volume of each part, and then calculate it with the density of each part, and finally add it up Get a result.
There are actually many questions in this category, such as: "Estimate the quality of the water in the Mississippi River." "If you
are the governor of Tennessee, please estimate how to manage Cumberland How long does it take for the river to become polluted? "
"Estimate the amount of rain that a person walking in light rain will receive in 5 minutes. "
Mr Miller continued. : "Questions like this, including some reasoning questions, all test people
ProblemSolving (problem-solving ability), it is not just about memorizing the answer to each question."
p>Regarding the purpose of company recruitment, Mr. Miller emphasized four points. These are the qualities of employees that creative companies generally focus on
and who want to realize their career dreams in well-known companies. Qualities and abilities that everyone must possess
.
Requirement 1: RawSmart (pure wisdom), which has nothing to do with knowledge.
Requirement 2: Long-term Potential (long-term learning ability).
Requirement three: TechnicSkills (skills).
Requirement 4: Professionalism (professional attitude).
6. Her answer is: Choose not to take the first five floors, observe the size of the diamonds on each floor, and be aware of it
. Choose on the next five floors, and choose a diamond that is close to the size of the largest diamond that appeared on the first five floors. She still
doesn't know the exact answer to this question. "Maybe there is no exact answer. I just want to test your thinking," she
said.
7. The seventh question is 17 minutes. Go past 1 and 2, remember 2 minutes, come back for 1 minute. Go past 5, 10, remember 10 minutes, come back 2 minutes, and then go past 1 and 2 together. Remember 2 minutes, so it is 2 1 10 2 2=17
8. Burn both sides together.
9. One of the answers: The answer I heard from a computer science professor at MIT is that first of all, it has the largest area with the same
materials. Secondly, if it is square, rectangular or oval, you can just pick it up and throw it directly into the underground tunnel! But a round lid can avoid this situation
)
10. When this question seems a bit confusing at first glance, you may want to start by asking this How many small cars are there in the country?
Start with cars. The interviewer may tell you this number, but he may also say: "I don't know, tell me." Then, you say to yourself, the population of the United States is 275 million. You can guess that if the average household size (including singles) is 2.5 people, your computer will tell you that there are 110 million households. Do you recall
hearing somewhere that the average household owns 1.8 cars, so there are approximately 198 million
cars in the United States. Then, just figure out how many gas stations are needed to serve 198 million cars, and you've solved the problem. It's not the number at the pump that matters, it's how you arrive at that number.
12. The answer is easy to calculate:
Suppose the distance from Los Angeles to New York is s
Then the distance the bird flies is (s/(15 20 ))*30.
13. No answer, it depends on whether you have the courage to stick to your opinion.
14. Because human eyes are symmetrical in the horizontal direction.
15. Take out one pill from the first box, two pills from the second box, and three pills from the third box.
By analogy, call it the total amount.
16. More complicated:
A. First fill a 3-quart bucket and pour in 5-quarts. Hereinafter referred to as 3-gt; 5)
Mark b1 in the 5-quart bucket, referred to as b1).
B. Use 3 to continue filling 5 with water. Empty 3. Pour water from 5 into 3 until b1. Mark b2 in 3.
C. Use 5 to continue filling with water. 3 Empty 5. Pour water from 3 into 5 until b2
D. Empty 3. Pour water from 5 into 3. Mark it as b3
E. Fill 5. Empty 3 and put 5 into middle Pour water into 3 until the water in 3 reaches b3
That's it. The water in 5 is now a standard 4 quarts of water.
20. Prime numbers are off, and the rest are on.
29. When two numbers are allowed to be repeated
The answer is x=1, y=4; A knows the sum A=x y=5, and B knows the product B=x*y =4
There are two answers when two numbers are not allowed to be repeated
Answer 1: x=1, y=6; A knows the sum A=x y=7, B Know that the product B=x*y=6
Answer 2: x=1, y=8; A knows the sum A=x y=9, and B knows the product B=x*y=8
Solution:
Let these two numbers be x, y.
A knows the sum of the two numbers A=x y;
B knows the two numbers The product of numbers B=x*y;
This question is divided into two situations:
Repeats are allowed, there are (1 lt; = x lt; = y lt; = 30);
When duplication is not allowed, there is (1 lt; = x lt; y lt; = 30);
When duplication is not allowed, that is (1 lt; = x lt; y lt ;= 30);
1) Conditions set by the question: B does not know the answer
lt;=gt; B=x*y solution is not unique
=gt; B=x*y is a non-prime number
and ∵ x ≠ y
∴ B ≠ k*k (where k∈N)
Conclusion (Corollary 1):
B=x*y is a non-prime number and B ≠ k*k (where k∈N)
That is: B ∈ (6, 8, 10, 12 , 14, 15, 18, 20...)
The proof process is omitted.
2) Conditions set by the question: A does not know the answer
lt; =gt; A=x y, the solution is not unique
=gt; A gt;= 5;
There are two situations:
When A=5, A=6, x and y have double solutions
When Agt; = 7, x and y There are three or more solutions
Suppose A=x y=5
Then there are double solutions
x1=1, y1=4;
x2=2, y2=3
Substitute the formula B=x*y:
B1=x1*y1=1*4=4; (Does not satisfy Corollary 1, round Go)
B2=x2*y2=2*3=6;
Obtain the only solution x=2, y=3, that is, A knows the answer.
Contradicts the condition of the question: "A does not know the answer",
Therefore, the assumption is not true, A=x y≠5
Assume A=x y=6
There are two solutions.
x1=1, y1=5;
x2=2, y2=4
Substitute the formula B=x*y:
B1=x1*y1=1*5=5; (does not satisfy Corollary 1, discard)
B2=x2*y2=2*4=8;
Obtain unique Solution x=2, y=4
That means A knows the answer
It contradicts the condition of the question: "A does not know the answer"
Therefore, the assumption is not valid. A=x y≠6
When Agt; = 7
∵ There are at least two solutions to x and y that satisfy Corollary 1
B1=x1 *y1=2*(A-2)
B2=x2*y2=3*(A-3)
∴ Meets the conditions
Conclusion (inference 2): A gt; = 7
3) Set the condition from the question: B said "Then I know"
=gt; B passes the known condition B=x*y And corollary (1) (2) can lead to the unique solution
That is:
A=x y, A gt; = 7
B=x*y , B ∈ (6, 8, 10, 12, 14, 15, 16, 18, 20...)
1 lt; = x lt; y lt; = 30
There is a unique solution for x and y
When B=6: there are two sets of solutions
x1=1, y1=6
x2=2, y2 =3 (∵ x2 y2=2 3=5 lt; 7∴ does not meet the meaning of the question, discard it)
Obtain the only solution x=1, y=6
When B=8 When: there are two sets of solutions
x1=1, y1=8
x2=2, y2=4 (∵ x2 y2=2 4=6 lt; 7∴ does not meet the meaning of the question , discarded)
Get the unique solution x=1, y=8
When Bgt; 8: it is easy to prove that they are multiple solutions
Conclusion:
When B=6, there is a unique solution x=1, y=6. When B=8, there is a unique solution x=1, y=8
4) Set the conditions according to the question: A said "Then I know it too"
=gt; A can get the unique solution through the known conditions A=x y and inference (3)
In summary, the original There are two sets of solutions to the question:
x1=1, y1=6
x2=1, y2=8
When xlt;=y, There is (1 lt; = x lt; = y lt; = 30);
In the same way, the only solution x=1, y=4 can be obtained
31.
Solution: 1000
Lg(1000!)=sum(Lg(n))
n=1
You can replace the curve with 3 segments of polyline Obtained
10(0 1)/2 90(1 2)/2 900(2 3)/2=2390
As an approximate result, it seems that 1500~3000 is considered correct
32. F(n)=1 ngt; 8 nlt; 12
F(n)=2 nlt; 2
<p> F(n)=3 n=6
F(n)=4 n=other
Use - * / and sign(n) functions to combine F(n) Function
sign(n)=0 n=0
sign(n)=-1 nlt; 0
: sign(n)=1 ngt; 0
Solution: Just pay attention to [sign(n-m)*sign(m-n) 1] and take 1 at n=m and 0 at other points.
34. Rice-shaped Just paint
59. The answer is to say goodbye to your family.