量子运算 简单通俗例子_什么是量子计算机? 用一个简单的例子解释。

量子运算 简单通俗例子

by YK Sugi

由YK Sugi

什么是量子计算机? 用一个简单的例子解释。 (What is a quantum computer? Explained with a simple example.)

Hi everyone!

嗨,大家好!

The other day, I visited D-Wave Systems in Vancouver, Canada. It’s a company that makes cutting-edge quantum computers.

前几天,我参观了加拿大温哥华的D-Wave Systems 。 这是一家生产尖端量子计算机的公司。

I got to learn a lot about quantum computers there, so I’d like to share some of what I learned there with you in this article.

我在那里学习了很多有关量子计算机的知识,所以我想在本文中与大家分享一些我在这里学到的东西。

The goal of this article is to give you an accurate intuition of what a quantum computer is using a simple example.

本文的目的是让您准确了解直觉量子计算机所使用的简单示例。

This article will not require you to have prior knowledge of either quantum physics or computer science to be able to understand it.

本文将不要求您具有量子物理学或计算机科学的先验知识才能理解。

Okay, let’s get started.

好的,让我们开始吧。

Edit (Feb 26, 2019): I recently published a video about the same topic on my YouTube channel. I would recommend watching it (click here) before or after reading this article because I have added some additional, more nuanced arguments in the video.

编辑(2019年2月26日):我最近在我的YouTube频道上发布了关于同一主题的视频 。 我建议在阅读本文之前或之后观看它( 单击此处 ),因为我在视频中添加了一些其他的,更细微的参数。

什么是量子计算机? (What is a quantum computer?)

Here is a one-sentence summary of what a quantum computer is:

这是量子计算机的一句话摘要:

A quantum computer is a type of computer that uses quantum mechanics so that it can perform certain kinds of computation more efficiently than a regular computer can.
量子计算机是一种使用量子力学的计算机,因此它可以比常规计算机更有效地执行某些类型的计算。

There is a lot to unpack in this sentence, so let me walk you through what it is exactly using a simple example.

这句话有很多要解开的地方,所以让我用一个简单的例子向您介绍它的确切含义。

To explain what a quantum computer is, I’ll need to first explain a little bit about regular (non-quantum) computers.

为了解释什么是量子计算机,我首先需要对常规(非量子)计算机进行一些解释。

普通计算机如何存储信息 (How a regular computer stores information)

Now, a regular computer stores information in a series of 0’s and 1’s.

现在,常规计算机以一系列0和1存储信息。

Different kinds of information, such as numbers, text, and images can be represented this way.

可以用这种方式表示不同种类的信息,例如数字,文本和图像。

Each unit in this series of 0’s and 1’s is called a bit. So, a bit can be set to either 0 or 1.

这个系列中的0和1的每个单位称为一位。 因此,可以将某位设置为0或1。

现在,量子计算机呢? (Now, what about quantum computers?)

A quantum computer does not use bits to store information. Instead, it uses something called qubits.

量子计算机使用位来存储信息。 相反,它使用一种称为qubits的东西。

Each qubit can not only be set to 1 or 0, but it can also be set to 1 and 0. But what does that mean exactly?

每个量子位不仅可以设置为1 0,还可以设置为1 0。但这到底意味着什么?

Let me explain this with a simple example. This is going to be a somewhat artificial example. But it’s still going to be helpful in understanding how quantum computers work.

让我用一个简单的例子对此进行解释。 这将是一个人为的例子。 但这仍然有助于理解量子计算机的工作原理。

一个了解量子计算机如何工作的简单示例 (A simple example for understanding how quantum computers work)

Now, suppose you’re running a travel agency, and you need to move a group of people from one location to another.

现在,假设您正在经营一家旅行社,并且需要将一群人从一个地点转移到另一个地点。

To keep this simple, let’s say that you need to move only 3 people for now — Alice, Becky, and Chris.

为简单起见,假设您现在只需要移动3个人-爱丽丝,贝基和克里斯。

And suppose that you have booked 2 taxis for this purpose, and you want to figure out who gets into which taxi.

并假设您已经为此预订了2辆出租车,并且您想弄清楚谁乘坐哪辆出租车。

Also, suppose here that you’re given information about who’s friends with who, and who’s enemies with who.

此外,在这里假设您获得有关谁与谁成为朋友以及谁与谁成为敌人的信息。

Here, let’s say that:

在这里,我们说:

  • Alice and Becky are friends

    爱丽丝和贝基是朋友
  • Alice and Chris are enemies

    爱丽丝和克里斯是敌人
  • Becky and Chris are enemies

    贝基和克里斯是敌人

And suppose that your goal here is to divide this group of 3 people into the two taxis to achieve the following two objectives:

并假设您的目标是将3人组成的团队分为两辆出租车,以实现以下两个目标:

  • Maximize the number of friend pairs that share the same car

    最大化共享同一辆车的朋友对的数量

  • Minimize the number of enemy pairs that share the same car

    减少共享同一辆车的敌人对的数量

Okay, so this is the basic premise of this problem. Let’s first think about how we would solve this problem using a regular computer.

好的,这是此问题的基本前提。 首先考虑一下如何使用常规计算机解决此问题。

用常规计算机解决此问题 (Solving this problem with a regular computer)

To solve this problem with a regular, non-quantum computer, you’ll need first to figure out how to store the relevant information with bits.

为了使用常规的非量子计算机解决此问题,您首先需要弄清楚如何使用位存储相关信息。

Let’s label the two taxis Taxi #1 and Taxi #0.

让我们标记两个出租车1号和0号出租车。

Then, you can represent who gets into which car with 3 bits.

然后,您可以用3位代表谁进入哪辆车。

For example, we can set the three bits to 0, 0, and 1 to represent:

例如,我们可以在三个位设置为0,0, 1代表:

  • Alice gets into Taxi #0

    爱丽丝进入出租车0
  • Becky gets into Taxi #0

    贝基进入出租车0
  • Chris gets into Taxi #1

    克里斯进入出租车#1

Since there are two choices for each person, there are 2*2*2 = 8 ways to divide this group of people into two cars.

由于每个人都有两个选择,因此有2 * 2 * 2 = 8种方法可以将这一组人分为两辆车。

Here’s a list of all possible configurations:

以下是所有可能配置的列表:

A | B | C0 | 0 | 00 | 0 | 10 | 1 | 00 | 1 | 11 | 0 | 01 | 0 | 11 | 1 | 01 | 1 | 1

A | B | C0 | 0 | 00 | 0 | 10 | 1 | 00 | 1 | 11 | 0 | 01 | 0 | 11 | 1 | 01 | 1 | 1个

Using 3 bits, you can represent any one of these combinations.

使用3位,您可以代表这些组合中的任何一种。

计算每种配置的分数 (Computing the score for each configuration)

Now, using a regular computer, how would we determine which configuration is the best solution?

现在,使用普通计算机,我们将如何确定哪种配置是最佳解决方案?

To do this, let’s define how we can compute the score for each configuration. This score will represent the extent to which each solution achieves the two objectives I mentioned earlier:

为此,让我们定义如何计算每种配置的得分。 这个分数将代表每种解决方案在多大程度上实现了我之前提到的两个目标:

  • Maximize the number of friend pairs that share the same car

    最大化共享同一辆车的朋友对的数量

  • Minimize the number of enemy pairs that share the same car

    减少共享同一辆车的敌人对的数量

Let’s simply define our score as follows:

让我们简单地定义得分如下:

(the score of a given configuration) = (# friend pairs sharing the same car) - (# enemy pairs sharing the same car)

(给定配置的分数)=(共享同一辆车的#个朋友对)-(共享同一辆车的#个敌人对)

For example, suppose that Alice, Becky, and Chris all get into Taxi #1. With three bits, this can be expressed as 111.

例如,假设Alice,Becky和Chris都进入了出租车1号。 使用三位,这可以表示为111

In this case, there is only one friend pair sharing the same car — Alice and Becky.

在这种情况下,只有一对朋友共享同一辆车-爱丽丝和贝基。

However, there are two enemy pairs sharing the same car — Alice and Chris, and Becky and Chris.

但是,有两个敌对共享同一辆车-爱丽丝和克里斯,贝基和克里斯。

So, the total score of this configuration is 1-2 = -1.

因此,此配置的总分是1-2 = -1。

解决问题 (Solving the problem)

With all of this setup, we can finally go about solving this problem.

通过所有这些设置,我们终于可以解决这个问题了。

With a regular computer, to find the best configuration, you’ll need to essentially go through all configurations to see which one achieves the highest score.

对于常规计算机,要找到最佳配置,您实际上需要仔细检查所有配置,以查看哪个配置得分最高。

So, you can think about constructing a table like this:

因此,您可以考虑构造一个像这样的表:

A | B | C | Score0 | 0 | 0 | -10 | 0 | 1 | 1 <- one of the best solutions0 | 1 | 0 | -10 | 1 | 1 | -11 | 0 | 0 | -11 | 0 | 1 | -11 | 1 | 0 | 1 <- the other best solution1 | 1 | 1 | -1

A | B | C | 得分0 | 0 | 0 | -10 | 0 | 1 | 1 <-最佳解决方案之一 1 | 0 | -10 | 1 | 1 | -11 | 0 | 0 | -11 | 0 | 1 | -11 | 1 | 0 | 1 <-另一个最佳解决方案1 ​​| 1 | 1 | -1

As you can see, there are two correct solutions here — 001 and 110, both achieving the score of 1.

如您所见,这里有两个正确的解决方案-001和110,都达到了1分。

This problem is fairly simple. It quickly becomes too difficult to solve with a regular computer as we increase the number of people in this problem.

这个问题很简单。 随着我们增加处理此问题的人数,使用常规计算机很快变得难以解决。

We saw that with 3 people, we need to go through 8 possible configurations.

我们看到只有3个人,我们需要完成8种可能的配置。

What if there are 4 people? In that case, we’ll need to go through 2*2*2*2 = 16 configurations.

如果有四个人怎么办? 在这种情况下,我们需要进行2 * 2 * 2 * 2 = 16个配置。

With n people, we’ll need to go through (2 to the power of n) configurations to find the best solution.

与n个人一起,我们将需要进行(2的n次方)个配置以找到最佳解决方案。

So, if there are 100 people, we’ll need to go through:

因此,如果有100个人,我们将需要完成以下工作:

  • 2¹⁰⁰ ~= 10³⁰ = one million million million million million configurations.

    2 17 = 10 3 =一亿亿亿亿亿个配置。

This is simply impossible to solve with a regular computer.

这是用常规计算机根本无法解决的。

用量子计算机解决这个问题 (Solving this problem with a quantum computer)

How would we go about solving this problem with a quantum computer?

我们将如何使用量子计算机解决这个问题?

To think about that, let’s go back to the case of dividing 3 people into two taxis.

考虑一下,让我们回到将3个人分为两辆出租车的情况。

As we saw earlier, there were 8 possible solutions to this problem:

正如我们之前看到的,有8种可能的解决方案:

A | B | C0 | 0 | 00 | 0 | 10 | 1 | 00 | 1 | 11 | 0 | 01 | 0 | 11 | 1 | 01 | 1 | 1

A | B | C0 | 0 | 00 | 0 | 10 | 1 | 00 | 1 | 11 | 0 | 01 | 0 | 11 | 1 | 01 | 1 | 1个

With a regular computer, using 3 bits, we were able to represent only one of these solutions at a time — for example, 001.

对于使用3位的常规计算机,我们一次只能代表这些解决方案之一,例如001。

However, with a quantum computer, using 3 qubits, we can represent all 8 of these solutions at the same time.

但是,使用一台量子计算机,使用3个量子位 ,我们可以同时表示所有8个解决方案

There are debates as to what it means exactly, but here’s the way I think about it.

关于确切含义的争论不休,但这是我对它的思考方式。

First, examine the first qubit out of these 3 qubits. When you set it to both 0 and 1, it’s sort of like creating two parallel worlds. (Yes, it’s strange, but just follow along here.)

首先,检查这3个量子位中的第一个量子位。 当你将它设置为 0和1,有点像创建两个平行的世界。 (是的,这很奇怪,但是请遵循此处。)

In one of those parallel worlds, the qubit is set to 0. In the other one, it’s set to 1.

在这些并行世界之一中,量子位设置为0。在另一个世界中,量子位设置为1。

Now, what if you set the second qubit to 0 and 1, too? Then, it’s sort of like creating 4 parallel worlds.

现在,如果您也将第二个量子比特设置为0 1,该怎么办? 然后,就像创建四个平行世界。

In the first world, the two qubits are set to 00. In the second one, they are 01. In the third one, they are 10. In the fourth one, they are 11.

在第一个世界中,两个量子位设置为00。在第二个世界中,它们设置为01。在第三个世界中,它们设置为10。在第四个世界中,它们设置为11。

Similarly, if you set all three qubits to both 0 and 1, you’d be creating 8 parallel worlds — 000, 001, 010, 011, 100, 101, 110, and 111.

同样,如果将所有三个量子位都设置为0和1,则将创建8个并行世界-000、001、010、011、100、101、110和111。

This is a strange way to think, but it is one of the correct ways to interpret how the qubits behave in the real world.

这是一种奇怪的思考方式,但它是解释量子位在现实世界中的行为的正确方法之一。

Now, when you apply some sort of computation on these three qubits, you are actually applying the same computation in all of those 8 parallel worlds at the same time.

现在,当您对这三个量子位应用某种计算时,实际上您实际上同时在所有这8个并行世界中应用了相同的计算。

So, instead of going through each of those potential solutions sequentially, we can compute the scores of all solutions at the same time.

因此,我们可以依次计算所有解决方案的得分,而不必依次检查每个潜在解决方案。

With this particular example, in theory, your quantum computer would be able to find one of the best solutions in a few milliseconds. Again, that’s 001 or 110 as we saw earlier:

通过这个特定的例子,理论上,您的量子计算机将能够在几毫秒内找到最佳解决方案之一。 同样,如我们先前所见,它是001或110:

A | B | C | Score0 | 0 | 0 | -10 | 0 | 1 | 1 <- one of the best solutions0 | 1 | 0 | -10 | 1 | 1 | -11 | 0 | 0 | -11 | 0 | 1 | -11 | 1 | 0 | 1 <- the other best solution1 | 1 | 1 | -1

A | B | C | 得分0 | 0 | 0 | -1 0 | 0 | 1 | 1 <-最佳解决方案之一| 1 | 0 | -10 | 1 | 1 | -11 | 0 | 0 | -11 | 0 | 1 | -1 1 | 1 | 0 | 1 <-其他最佳解决方案1 ​​| 1 | 1 | -1

In reality, to solve this problem, you would need to give your quantum computer two things:

实际上,要解决此问题,您需要给量子计算机两件事:

  • All potential solutions represented with qubits

    量子位表示所有可能的解决方案
  • A function that turns each potential solution into a score. In this case, this is the function that counts the numbers of friend pairs and enemy pairs sharing the same car.

    将每个潜在解决方案转化为得分的功能。 在这种情况下,该功能可以计算共享同一辆汽车的朋友对和敌人对的数量。

Given these two things, your quantum computer will spit out one of the best solutions in a few milliseconds. In this case, that’s 001 or 110 with a score of 1.

鉴于这两件事,您的量子计算机将在几毫秒内吐出最佳解决方案之一。 在这种情况下,分数是1的001或110。

Now, in theory, a quantum computer is able to find one of the best solutions every time it runs.

现在,从理论上讲,量子计算机能够在每次运行时找到最佳解决方案之一。

However, in reality, there are errors when running a quantum computer. So, instead of finding the best solution, it might find the second-best solution, the third best solution, and so on.

但是,实际上,运行量子计算机时会出错。 因此,与其找到最佳解决方案,不如寻找第二好解决方案,第三好解决方案,依此类推。

These errors become more prominent as the problem becomes more and more complex.

随着问题变得越来越复杂,这些错误变得更加突出。

So, in practice, you will probably want to run the same operation on a quantum computer dozens of times or hundreds of times. Then pick the best result out of the many results you get.

因此,实际上,您可能希望在量子计算机上运行数十次或数百次相同的操作。 然后从获得的许多结果中选择最佳结果。

量子计算机如何扩展 (How a quantum computer scales)

Even with the errors I mentioned, the quantum computer does not have the same scaling issue a regular computer suffers from.

即使有我提到的错误,量子计算机也不会像普通计算机那样遇到相同的缩放问题。

When there are 3 people we need to divide into two cars, the number of operations we need to perform on a quantum computer is 1. This is because a quantum computer computes the score of all configurations at the same time.

当我们需要将3个人分为两辆车时,我们需要在量子计算机上执行的操作数为1。这是因为量子计算机同时计算所有配置的得分。

When there are 4 people, the number of operations is still 1.

当有4个人时,操作数仍为1。

When there are 100 people, the number of operations is still 1. With a single operation, a quantum computer computes the scores of all 2¹⁰⁰ ~= 10³⁰ = one million million million million million configurations at the same time.

当有100个人时,操作数仍为1。通过一次操作,量子计算机将同时计算所有2 1〜 = 10 3 = 1亿亿亿亿亿配置的分数。

As I mentioned earlier, in practice, it’s probably best to run your quantum computer dozens of times or hundreds of times and pick the best result out of the many results you get.

如前所述,在实践中,最好是运行量子计算机数十次或数百次,然后从获得的众多结果中挑选出最佳结果。

However, it’s still much better than running the same problem on a regular computer and having to repeat the same type of computation one million million million million million times.

但是,它仍然比在常规计算机上运行相同的问题并且必须重复相同类型的计算1亿亿亿亿亿次更好。

结语 (Wrapping up)

Special thanks to everyone at D-Wave Systems for patiently explaining all of this to me.

特别感谢D-Wave Systems的所有人耐心向我解释了所有这些。

D-Wave recently launched a cloud environment for interacting with a quantum computer.

D-Wave最近推出了一种用于与量子计算机进行交互的云环境。

If you’re a developer and would like actually to try using a quantum computer, it’s probably the easiest way to do so.

如果您是开发人员,并且想实际尝试使用量子计算机,那可能是最简单的方法。

It’s called Leap, and it’s at https://cloud.dwavesys.com/leap. You can use it for free to solve thousands of problems, and they also have easy-to-follow tutorials on getting started with quantum computers once you sign up.

它称为Leap,位于https://cloud.dwavesys.com/leap 。 您可以免费使用它来解决成千上万的问题,并且一旦注册,他们还将提供易于遵循的有关量子计算机入门的教程。

Footnote:

脚注:

  • In this article, I used the term “regular computer” to refer to a non-quantum computer. However, in the quantum computing industry, non-quantum computers are usually referred to as classical computers.

    在本文中,我使用术语“常规计算机”来指代非量子计算机。 然而,在量子计算工业中,非量子计算机通常被称为经典计算机。

翻译自: https://www.freecodecamp.org/news/what-is-a-quantum-computer-explained-with-a-simple-example-b8f602035365/

量子运算 简单通俗例子

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/393081.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

linux增加端口失败,端口没被占用,怎么会bind失败呢?

今天在一个服务器上部署一个webserver的时候&#xff0c;提示我bind端口失败&#xff0c;我习惯性的用netstat看了下&#xff0c;没有被占用啊&#xff01;把问题分享出来后&#xff0c;给力的同事们搜索到了ip_local_port_range这个东西这个东西对应的是/proc/sys/net/ipv4/ip…

leetcode面试题 17.15. 最长单词

给定一组单词words&#xff0c;编写一个程序&#xff0c;找出其中的最长单词&#xff0c;且该单词由这组单词中的其他单词组合而成。若有多个长度相同的结果&#xff0c;返回其中字典序最小的一项&#xff0c;若没有符合要求的单词则返回空字符串。 示例&#xff1a; 输入&am…

Restful API 设计

1. 简介 目前 "互联网软件"从用客户端/服务端模式&#xff0c;建立在分布式体系上&#xff0c;通过互联网通讯&#xff0c;具有高延时、高开发等特点。但是软件开发和网络是两个不同的领域&#xff0c;交集很少。要使得两个融合&#xff0c;就要考虑如何在互联网环境…

sql行数少于10_如何用少于100行的代码创建生成艺术

sql行数少于10by Eric Davidson埃里克戴维森(Eric Davidson) 如何用少于100行的代码创建生成艺术 (How to Create Generative Art In Less Than 100 Lines Of Code) Generative art, like any programming topic, can be intimidating if you’ve never tried it before. I’v…

安装输入发

直接在系统 ——系统管理 ——语言支持 选——中文从新启动 sudo apt-get install scim-pinyin安装JAVA环境支持 sudo apt-get install sun-java-jre()要是 apt -get 命令不能用 可能是你 的 源有问题 可以 更新一下 在系统 &#xff0d;系统管理 源设置 选这台湾的 就可以 …

(第2篇)一篇文章教你轻松安装hadoop

摘要: 这篇文章将会手把手教你安装hadoop&#xff0c;只要你细心按照文章中的步骤操作&#xff0c;hadoop肯定能正确安装&#xff0c;绝对不会让你崩溃 博主福利 给大家赠送一套hadoop视频课程 授课老师是百度 hadoop 核心架构师 内容包括hadoop入门、hadoop生态架构以及大型ha…

linux cpio到指定目录,linux cpio命令存取归档包中的文件

功能描述使用cpio命令可以通过重定向的方式将文件进行打包备份及还原恢复&#xff0c;它可以解压缩以“.cpio”或者“.tar”结尾的文件。命令语 法cpio [选项] [目标目录]选项含义选项含义-o执行 copy-out 模式&#xff0c;建立备份档。-i执行 copy-in 模式&#xff0c;还原备份…

leetcode剑指 Offer 20. 表示数值的字符串

请实现一个函数用来判断字符串是否表示数值&#xff08;包括整数和小数&#xff09;。例如&#xff0c;字符串"100"、“5e2”、"-123"、“3.1416”、"-1E-16"、“0123"都表示数值&#xff0c;但"12e”、“1a3.14”、“1.2.3”、"…

python接口自动化2-发送post请求

前言 发送post的请求参考例子很简单&#xff0c;实际遇到的情况却是很复杂的&#xff0c;首先第一个post请求肯定是登录了&#xff0c;但登录是最难处理的。登录问题解决了&#xff0c;后面都简单了。 一、查看官方文档 1.学习一个新的模块&#xff0c;其实不用去百度什么的&am…

简介浏览器内核与JavaScript引擎

本文介绍了常用浏览器内核与JavaScript引擎 一、浏览器内核 Rending Engine, 顾名思义&#xff0c;称之为渲染网页内容的&#xff0c;将网页的代码转换为你看得见的页面&#xff0c;因为是排版&#xff0c;所以排版&#xff0c;所以肯定会有排版错误等问题。为什么会有排版错误…

Linux查看tar实用程序,linux tar指令常用选项

linux的tar指令经常被用到&#xff0c;因为压缩文件的时候通常需要打包文档&#xff0c;而tar指令就是打包指令&#xff0c;同时gzip压缩程序和bzip2压缩程序都是支持tar指令的&#xff0c;所以tar指令在打包的同时还可以用gzip和bzip进行压缩&#xff0c;这样多文件可以打包的…

代码字体mono_如何构建代码存储库:Multi,Mono或Organic?

代码字体monoby Chetan Sharma由Chetan Sharma 如何构建代码存储库&#xff1a;Multi&#xff0c;Mono或Organic&#xff1f; (How to Structure Code Repositories: Multi, Mono, or Organic?) The newest debate in town is whether you should keep your services in a si…

leetcode1424. 对角线遍历 II(排序)

给你一个列表 nums &#xff0c;里面每一个元素都是一个整数列表。请你依照下面各图的规则&#xff0c;按顺序返回 nums 中对角线上的整数。 示例 1&#xff1a; 输入&#xff1a;nums [[1,2,3],[4,5,6],[7,8,9]] 输出&#xff1a;[1,4,2,7,5,3,8,6,9] 代码 class Solution …

DaVinci各版本安装指南

链接: https://pan.baidu.com/s/1g1kaXZxcw-etsJENiW2IUQ?pwd0531 ​ #2024版 1.鼠标右击【DaVinci_Resolve_Studio_18.5(64bit)】压缩包&#xff08;win11及以上系统需先点击“显示更多选项”&#xff09;【解压到 DaVinci_Resolve_Studio_18.5(64bit)】。 2.打开解压后的文…

使用 Servlet 读取表单数据

Technorati 标签: servlet&#xff1b;java 一、概述 Servlet 有一个比较好的功能就是可以自动处理表单提交的数据。我们只需要调用HttpServletRequest#getParameter(String name),就可以获得指定参数的值&#xff08;String&#xff09;&#xff0c;注意此方法是大小写敏感的。…

linux文档权限

1、登录 root 用户&#xff1a;su - mac一开始进入创建的用户是具有管理员权限的用户&#xff0c;但是密码却不是进入 root 用户的密码&#xff0c;可以使用 sudo su - 免密进入 root 用户。 2、退出 root 用户&#xff1a;exit 3、列出档案&#xff08;包括隐藏的档案&#xf…

小程序 仿麦当劳_手机上的麦当劳和星巴克:为什么现在首先使用移动应用程序...

小程序 仿麦当劳by James Hsu由徐H 手机上的麦当劳和星巴克&#xff1a;为什么现在首先使用移动应用程序 (McDonald’s and Starbucks on Your Phone: Why Mobile Apps Are Now First on the Menu) One Friday this July, I got excited about McDonalds. So excited that I s…

MyLinkedList

/*** 节点类* author JP* */ class Node {Object value;//节点元素值Node pre;//上一个节点Node next;//下一个节点public Node(Object value) {this.value value;} }/*** 链表类* author JP**/ public class MyLinkedList {Node cur;//目前指向的节点Node head;//头结点Node …

linux开启ping服务,Linux 云服务器禁止和开启Ping

原标题&#xff1a;Linux 云服务器禁止和开启Ping在使用Linux服务器的时候&#xff0c;一般系统默认是开启ping的&#xff0c;比如我们可以ping测试网络的延迟质量。当然也有部分服务商是可以通过安全组设置禁止ping的&#xff0c;我们可以设置安全组对应项目开启或禁止ping&am…

leetcode1432. 改变一个整数能得到的最大差值(贪心)

给你一个整数 num 。你可以对它进行如下步骤恰好 两次 &#xff1a; 选择一个数字 x (0 < x < 9). 选择另一个数字 y (0 < y < 9) 。数字 y 可以等于 x 。 将 num 中所有出现 x 的数位都用 y 替换。 得到的新的整数 不能 有前导 0 &#xff0c;得到的新整数也 不能…