A heavy rain triggered thinking _ programmer

Source: Internet
Author: User

Yesterday evening, the capital suddenly rained down, coincides with colleagues to the company near the school canteen to eat dinner, so I bolted all the way, but my colleagues are calm, Shing, I asked him you are not afraid of getting caught, he replied, go fast walking slowly, the same distance, the rain as much.
This answer let me one Leng, the heart some whispered. Wait until the canteen open to eat, my programmer was ill committed (to take an umbrella will not be soaked, must be dead end.) ), so I ask this question again:

2 people rainy Day by the company to eat food in the canteen, a walk fast, a walk slowly, which rain less.

I thought of the solution between the meals. I think it is very interesting, it is necessary to record.
First of all, this is the problem of complex environmental factors, so I can think of this problem is first abstracted into a mathematical problem, that is, mathematical modeling.
Some complex factors are assumed to be the ideal factor first.
One of the uncertainties is how to define rain, how to define people's speed, and how to define a person's rain-affected area.
So the above questions I first abstract into the following mathematical problems.

Assuming the company is 200m from the canteen, it is raining (rainfall is stable, rain and people in the direction of vertical, rain is still reference material, rainfall is 1 square meters within 1 seconds have 100 drops, a to 2m/s speed forward, B to 1m/s speed forward, people's rain area is consistent, is 1 square meters, please arrive at the canteen who rain less.

Abstract into a mathematical problem, there will be a deviation from the actual problem, but the results of the mathematical problem is still very useful for practical problems.

People's rain area is 1 square meters, can be explained as a person in the rain for 1 seconds, will receive 100 drops of rain.

According to this mathematical problem, a speed is 2m/s, then the 1m is 0.5s. B speed 1m/s, 1m is 1s.

Analysis here, a flash, think of the core of the central idea of scheduling, macro parallel, micro serial AH.
The 200m is divided into 200 1m to see, we look at everyone in 1m of rain, multiplied by 200, is the total rain.

A walk 1m with 0.5s, can imagine for a in 1m stay 0.5s, and people's rain area is 1 square meters,
Then a walk 1m rain 50 drops.

The same reason, B walk 1m rain 100 drops.

Thinking about it, it occurred to me that the problem could be simplified as follows:

A standing in the rain for 100 seconds, B standing in the rain for 200 seconds, who rain less.

The answer is clear enough, haha.

Regardless of my method right and wrong, from the actual problem of abstraction, step-by-step simplification of the problem, this idea for me is still very valuable.
In peacetime work, in addition to the development of embedded system porting, Debug is also a very important work. When solving some Linux kernel system-level bugs, it may not be as clear as a driver bug, and sometimes you don't know where to begin.
My feeling, the solution of the idea of a bug with the rain problem solution is the same, abstract simplification, it may be the problem has a very complex anomaly, from this complex anomaly is not good debug.
You can start with a simple anomaly, cobwebs, and you'll find the bug somewhere.
One of the most wonderful bugs that have been encountered before is this, linked as follows:
http://blog.csdn.net/skyflying2012/article/details/44623515

Rain problem of this set of ideas I do not guarantee is the best, after all, is improvised.
But I think the solution to this problem, I think of mathematical modeling, from the way of simplifying the idea must be correct, this for peacetime work in the debug is still very useful reference.

Or that sentence, want to be a system-level programmer, the broad idea is always more important than knowledge.

But for the good, do not ask the future.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.