Joke Collection Website - Cold jokes - What is binary?
What is binary?
This is a cold joke that has been circulating among programmers for a long time
Can't find the punch line?
It doesn't matter. After reading this article and reading this sentence again, you will smile.
go back to the past
Let's assume that you go back to junior high school, when you are in "Seeds of Love". I like my little brother (sister) facing the street, and the windows of your two houses face each other. During the winter vacation, you made an appointment to sneak out for a date at eight o'clock one night. But I can't let my parents know, so I can't tell each other by phone if I can sneak out tonight. In order not to let the other party wait for nothing, you have to agree on a new way of communication.
This new communication mode should meet the following requirements:
Quiet-you can't let your parents hear you. It's better to be quiet.
Easy to understand-the other party can know the information you want to express immediately after seeing it.
Because you live very close, you can see each other's home from the window, and you are smart enough to think that you can communicate with the lights of the chandelier at home.
Your appointment is at eight o'clock.
If the light in my room is on, it means I can sneak out smoothly.
Please click to enter a picture description.
If the light in my room doesn't work, it means I can't sneak out smoothly.
Please click to enter a picture description.
Now you can use the light switch in the room to express two states.
O: Can you come out?
Guan: You can't come out.
You can send messages to each other quietly, which is perfect!
New problems
But after a while, you found new problems. Sometimes, something happens after 8 o'clock, and it may take half an hour to sneak out. Sometimes, things after 8 o'clock may take 1 hour to come out.
Now you have four kinds of information to convey.
Come out at eight o'clock sharp tonight.
Can't come out tonight
You can come out at 8: 30 tonight.
Can come out at 9 o'clock tonight
But the switch of a lamp can only indicate two states. What should I do?
Smart, you immediately think that you can add another lamp! You put the lamp on the table in front of the window.
And updated the previous communication methods.
The desk lamp is off and the chandelier is off-it's impossible to go out tonight.
Please click to enter a picture description.
The desk lamp is off and the chandelier is on-8 o'clock tonight, be there or be square.
Please click to enter a picture description.
The desk lamp is on, the chandelier is off-it's half an hour late and I won't sneak out until 8: 30 tonight.
Please click to enter a picture description.
The desk lamp is on, the chandelier is on-delay 1 hour, and I will sneak out at 9 o'clock tonight.
Please click to enter a picture description.
Wow, once again, I solved this problem with my own intelligence.
Now you use two lights to represent four states.
Some ideas
Let's rephrase it with symbols.
We use the number 0 to indicate that the light is off.
The number 1 indicates that the light is on.
The position of the lamp
0 = = >; Come out at eight o'clock sharp tonight.
1 == > I can't come out at eight o'clock tonight.
The situation of two lamps
0 0 == > There is no chance tonight. I can't get out.
0 1 == > 8 o'clock tonight, be there or be square.
1 0 == > put it off for half an hour and sneak out at 8: 30 tonight.
1 1 == > delay 1 hour, and we won't be able to sneak out until 9 o'clock tonight.
Let's simplify the right side of the arrow again. We use the numbers 0, 1, 2, 3 to represent the four states of the date tonight.
0: There is no play tonight, so I can't get out.
65438+ 0: 8 tonight, be there or be square.
2: put it off for half an hour and sneak out at 8: 30 tonight.
3: delay 1 hour, and sneak out at 9 o'clock tonight.
Now we can simplify both sides with numbers.
00 == >0
0 1 == > 1
10 == >2
1 1 == > three
If you add another lamp, how many states can you show?
000 == >0
00 1 == > 1
0 10 == >2
0 1 1 == > three
100 == > 4
10 1 == > 5
1 10 == > six
1 1 1 == > seven
One * * * is eight kinds.
Ok, now I tell you, I have started to use binary!
That's right!
The left is binary, and the right is the corresponding decimal.
For example, the binary number11stands for the decimal number 7 that we often use.
Why?
Although you may not believe it, it is true that you have started to use binary.
So what about binary?
We all use decimal system in our daily life, that is, from 10 to 1.
1
2
three
four
five
six
seven
eight
nine
10
1 1
12
13
14
15
When you want to count 10, you should enter 1 bit, that is, write 1 bit for ten digits and write 0 for ten digits.
Yes 10.
Binary is all binary 1,
1
10
1 1
10
100
To count 2, enter 1 bit, the next bit writes 1, and the current bit becomes 0.
That is 10.
Binary to decimal
So we see a binary number, how do we know what it stands for in 10?
Let's think about the decimal number 10 1, and we can easily read it as 10 1.
But how do we know that 10 1 is11?
Because we know
Count from right to left.
The first number is a number, and the number of this number is what it is.
The second place is ten, and the number of this place means dozens.
The second place is 100, and the number of this place means 100.
Please click to enter a picture description.
Therefore,101=100+0x10+1x1.
One hundred+zero 10+ one one.
We introduce a new noun weight here to express the practical meaning of each bit.
Unit weight 1 = 10 0? The zeroth power of ten
Ten digits-the first power of the weight 10 = 10 1.
Hundred digits-weight100 =10x10 =10 20 quadratic.
Thousands-weight1000 =10x10x10 =10 30 cubic meters.
You can see that the weights are expanded by 10 times from right to left.
So we can come to the conclusion that
In fact, it is the number of each bit multiplied by the weight of this bit, and then added.
10 1 = 1x 10+0 * 10+ 1x 1
Expressed by power
10 1 = 1x( 10^2)+0x( 10^ 1)+ 1x( 10^0)= 1x 100+0x 10+ 1 = 10 1
Ok, how do we know the specific size of the binary? We just need to apply this formula.
So first of all, we need to know the weight of each bit of binary.
Since the weight of each decimal bit is a power of 10,
Then the weight of each bit of binary is naturally a power of 2.
Count from right to left
The first bit is the zeroth power of1= 2 0.
The second bit 2 = 2 1 2 to the first power.
The third number is 4 = 2x2= 2^2 quadratic.
Back to our previous question,
Binary 10 1, as we can know from the above state table.
000 == >0
00 1 == > 1
0 10 == >2
0 1 1 == > three
100 == > 4
10 1 == > 5
1 10 == > six
1 1 1 == > seven
Represents 5.
Transformation process
10 1 = 1x(2^2)+0x2^ 1+ 1x(2^0)= 1x 4+0x 2+ 1 = 5
How's it going? It's simple!
Grab this stalk.
Let's go back to our original joke.
There are 10 kinds of people in the world: those who know binary and those who don't. In fact, 10 here is binary, and when converted into decimal, it is10 =1x (21)+0x (20) = 65438.
It is actually a decimal 2.
Did you laugh?
- Previous article:Everyone has some jokes! ! ! !
- Next article:Shi Xiu plays the role of Water Margin.
- Related articles
- What are the jokes in Romance of the Three Kingdoms that are not easy to find?
- Make sentences in hot weather (about 30 sentences)
- It's a joke that Mandarin is not easy to speak.
- Selling Sheep is selected from Qi Yan Lu. There was a scholar in the Liang Dynasty who was stupid and seldom argued. He never understood sheep. Translate it. What does this story tell us?
- Netizens joked that they wanted to beat anchor Emperor Shi but he was beaten up by a group of people. Why did netizens say he deserved to be beaten?
- Some interesting sentences about friends
- How do you say Japanese funny and scissors stone cloth?
- I have the voice of a baby.
- Zengzi’s method of educating children
- Talk about perfunctory