当前位置:网站首页>Girl fan wants to find a boyfriend, but it's for
Girl fan wants to find a boyfriend, but it's for
2022-07-27 10:14:00 【51CTO】
Late at night, I have nothing to do , Brush my fan group , I saw a female fan writing code so late 、 Change bug, I was immediately moved :

It seems that she has encountered difficulties in code , I really want to find a boyfriend to help solve it .
So I suddenly made up a topic :
Female fan you N individual bug Need modification , Yes M A boy , Each boy will revise a part bug. ask : At least choose a few boys as boyfriends , To repair all bug?( Make sure that each bug At least one boy will modify )
After thinking for a long time, I didn't figure out how to do , Then a want to , This can be abstracted into a 「 Set covering problem 」 Do you ?
A collection has N Elements ,M A subset of , ask : At least a few subsets can cover all elements ?
Baidu search , I was stunned :

This is actually a NP- Problem completely , That is, there is no polynomial time solution .
The correct solution is to enumerate all the boy subsets , See who can solve all the problems by choosing a boyfriend bug, So the time complexity is
.
Of course, there are approximate solutions ,「 Choose boyfriends one by one 」. Every time from the remaining boys who haven't chosen , Choose the one that can solve the most remaining bug As a boyfriend . All the way to bug It's all solved .
In this way, the problem is perfectly solved ! Boyfriends line up in order to talk , Pick the one with the greatest advantage every time , After solving your own problems, you can divide . When encountering new problems , Continue to choose the one who can solve the most problems as your boyfriend . Until no new problems arise .
I didn't expect ordinary female fans , There is also a classic in the field of computer theory NP- Problem completely . This also proves the old saying ,「 Science comes from life 」.
Wish this girl bug less and less , The code is getting better , Surpass me as soon as possible .

边栏推荐
- 历时一年,论文终于被国际顶会接收了
- Easy to understand! Graphic go synergy principle and Practice
- pytorch中对BatchNorm2d()函数的理解
- Introduction to Matlab real time editor
- Example of ICP registration for PCL
- ACL2021最佳论文出炉,来自字节跳动
- 二叉树习题总结
- pillow的原因ImportError: cannot import name ‘PILLOW_VERSION‘ from ‘PIL‘,如何安装pillow<7.0.0
- Shell variables, system predefined variables $home, $pwd, $shell, $user, custom variables, special variables $n, $, $*, [email protected],
- Interview JD T5, was pressed on the ground friction, who knows what I experienced?
猜你喜欢

华为交换机双上行组网Smart-link配置指南

What happens if the MySQL disk is full? I really met you!
![Text processing tool in shell, cut [option parameter] filename Description: the default separator is the built-in variable of tab, awk [option parameter] '/pattern1/{action1}filename and awk](/img/ed/941276a15d1c4ab67d397fb3286022.png)
Text processing tool in shell, cut [option parameter] filename Description: the default separator is the built-in variable of tab, awk [option parameter] '/pattern1/{action1}filename and awk

NFT system development - Tutorial

Shell的read 读取控制台输入、read的使用

Data visualization

Anaconda installation (very detailed)

Food safety | the kitchen board environment is very important. Do you know these use details?

QT learning (II) -- a brief introduction to QT Creator

Review of in vivo detection
随机推荐
Shell的正则表达式入门、常规匹配、特殊字符:^、$、.、*、字符区间(中括号):[ ]、特殊字符:\、匹配手机号
Concurrent thread state transition
GBase 8a MPP集群扩容实战
食品安全 | 菜板环境很重要,这些使用细节你知道吗?
Open3d library installation, CONDA common instructions, importing open3d times this error solving environment: failed with initial frozen solve Retrying w
Discussion on a problem
Leetcode.1260. 2D grid migration____ In situ violence / dimensionality reduction + direct positioning of circular array
Matlab-绘制叠加阶梯图和线图
Shell process control (emphasis), if judgment, case statement, let usage, for ((initial value; loop control condition; variable change)) and for variable in value 1 value 2 value 3..., while loop
There is no CUDA option in vs2019+cuda11.1 new project
食品安全 | 垃圾食品越吃越想吃?这份常见食品热量表请收好
Configuration of pytorch deep learning environment based on cuda10.0
Shell流程控制(重点)、if 判断、case 语句、let用法、for 循环中有for (( 初始值;循环控制条件;变量变化 ))和for 变量 in 值 1 值 2 值 3… 、while 循环
文件上传漏洞绕过方法
ACL2021最佳论文出炉,来自字节跳动
女粉想要找男朋友,竟是为了...
Introduction to regular expressions of shell, general matching, special characters: ^, $,., * Character range (brackets): [], special characters: \, matching mobile phone number
Provincial Emergency Management Department: Guangzhou can strive to promote the experience of emergency safety education for children
Metaaploit-后渗透技知识
使用 Kmeans聚类实现颜色的分割