c#排列组合算法

2023-10-27

Combinatorics.cs代码清单
 
using System;
using System.Collections;
using System.Data;
 
     /// <summary>
     /// 组合数学函数集
     /// </summary>
     public class Combinatorics
     {        
         #region 公共函数
 
         
         /// <summary>
         /// 把二维整形数组转换为数据表
         /// </summary>
         public static DataTable TwoDemisionIntArrayToDataTable(int[, ]source)
         {
              DataTable dt = new DataTable();
              DataRow dr;
              int i, j;
         
              int b1 = source.GetUpperBound(0), b2 = source.GetUpperBound(1);                //获取二维表的各维长度                         
 
              for (i = 0; i <= b1; i ++ )                                                         //以第二维长度创建数据表的各字段
                   dt.Columns.Add(i.ToString(), System.Type.GetType("System.Int32"));
 
              for (i = 0; i <= b2; i ++ )                                                         //对各返回排列循环
              {
                   dr = dt.NewRow();                                                              //准备插入新行
                   for (j = 0; j <= b1; j ++ )                                                    //在新行中逐个填入返回排列的各元素次序                
                       dr[j.ToString()] = source[j, i];                                      //用序数指针获取原元素的值
                   dt.Rows.Add(dr);                                                               //插入新行
              }
 
              return dt;
         }    
 
         /// <summary>
         /// 连乘积函数         
         /// </summary>
         public static int Product(int start, int finish)
         {
              int factorial = 1;
              for (int i = start; i <= finish; i ++ )
                   factorial *= i;
              return factorial;
         }                  
 
         /// <summary>
         /// 阶乘函数       
         /// </summary>
         public static int Factorial(int n)
         {
              return Product(2, n);
         }                           
 
         /// <summary>
         /// 排列数函数         
         /// </summary>
         public static int ArrangeCount(int m, int n)
         {
              return Product(n - m + 1, n);        
         }
         
         /// <summary>
         /// 生成排列表函数     
         /// </summary>
         public static int[, ]Arrange(int m, int n)
         {
              int A = ArrangeCount(m, n);               //求得排列数,安排返回数组的第一维
              int[, ]arrange = new int[m, A];           //定义返回数组
              ArrayList e = new ArrayList();            //设置元素表
              for (int i = 0; i < n; i ++ )
                   e.Add(i + 1);
              Arrange(ref arrange, e, m, 0, 0);
              return arrange;
         }
 
         /// <summary>
         /// 组合数函数         
         /// </summary>
         public static int CombinationCount(int m, int n)
         {
              int a = Product(n - m + 1, n), b = Product(2, m);       //a=n-m+1 * ... * n ; b = m!
              return (int) a/b;                                            //c=a/b                              
         }
 
         /// <summary>
         /// 生成组合表函数     
         /// </summary>
         public static int[, ]Combination(int m, int n)
         {
              int A = CombinationCount(m, n);                //求得排列数,安排返回数组的第一维
              int[, ]combination = new int[m, A];            //定义返回数组
              ArrayList e = new ArrayList();                 //设置元素表
              for (int i = 0; i < n; i ++ )
                   e.Add(i + 1);
              Combination(ref combination, e, m, 0, 0);
              return combination;
         }
         
 
         #endregion
         
         #region 内部核心
 
         /// <summary>
         /// 排列函数
         /// </summary>
         /// <param name="reslut">返回值数组</param>
         /// <param name="elements">可供选择的元素数组</param>
         ///  <param name="m">目标选定元素个数</param>           
         /// <param name="x">当前返回值数组的列坐标</param>
         /// <param name="y">当前返回值数组的行坐标</param>
         private static void Arrange(ref int[, ]reslut, ArrayList elements, int m, int x, int y)
         {             
              int sub = ArrangeCount(m - 1, elements.Count - 1);                    //求取当前子排列的个数
              for (int i = 0; i < elements.Count; i++, y += sub)                    //每个元素均循环一次,每次循环后移动行指针
              {                  
                  int val = RemoveAndWrite(elements, i, ref reslut, x, y, sub);                                                                                    
                   if (m > 1)                                                                 //递归条件为子排列数大于1
                       Arrange(ref reslut, elements, m - 1, x + 1, y);
                   elements.Insert(i, val);                                              //恢复刚才删除的元素                  
              }
         }
         
         /// <summary>
         /// 组合函数
         /// </summary>
         /// <param name="reslut">返回值数组</param>
         /// <param name="elements">可供选择的元素数组</param>
         ///  <param name="m">目标选定元素个数</param>           
         /// <param name="x">当前返回值数组的列坐标</param>
         /// <param name="y">当前返回值数组的行坐标</param>
         private static void Combination(ref int[, ]reslut, ArrayList elements, int m, int x, int y)
         {             
              ArrayList tmpElements = new ArrayList();                              //所有本循环使用的元素都将暂时存放在这个数组
              int elementsCount = elements.Count;                                        //先记录可选元素个数
              int sub;
              for (int i = elementsCount - 1; i >= m - 1; i--, y += sub)            //从elementsCount-1(即n-1)到m-1的循环,每次循环后移动行指针
              {
                   sub = CombinationCount(m-1,i);                                   //求取当前子组合的个数
                   int val = RemoveAndWrite(elements, 0, ref reslut, x, y, sub);                                                                 
                   tmpElements.Add(val);                                                 //把这个可选元素存放到临时数组,循环结束后一并恢复到elements数组中                 
                   if (sub > 1 || (elements.Count + 1 == m && elements.Count > 0))  //递归条件为 子组合数大于1 或 可选元素个数+1等于当前目标选择元素个数且可选元素个数大于1
                       Combination(ref reslut, elements, m - 1, x + 1, y);                                 
              }
              elements.InsertRange(0, tmpElements);                                 //一次性把上述循环删除的可选元素恢复到可选元素数组中           
         }
 
         /// <summary>
         /// 返回由Index指定的可选元素值,并在数组中删除之,再从y行开始在x列中连续写入subComb个值
         /// </summary>
         private static int RemoveAndWrite(ArrayList elements, int index, ref int[, ]reslut, int x, int y, int count)
         {
              int val = (int) elements[index];
              elements.RemoveAt(index);
              for (int i = 0; i < count; i ++ )
                   reslut[x, y + i] = val;              
              return val;
         }        
         
         #endregion 
     }
 
 
 
 
测试窗体frmTest.cs代码清单: 
 
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
 
namespace CombinatoricsLib
{
     /// <summary>
     /// Form1 的摘要说明。
     /// </summary>
     public class frmTest : System.Windows.Forms.Form
     {
         private System.Windows.Forms.DataGrid gridShow;
         private System.Windows.Forms.NumericUpDown numM;
         private System.Windows.Forms.Button btnGo;
         private System.Windows.Forms.DomainUpDown domainFunction;
         private System.Windows.Forms.StatusBar statusBar1;
         private System.Windows.Forms.StatusBarPanel panelErrMsg;
         private System.Windows.Forms.NumericUpDown numN;
         /// <summary>
         /// 必需的设计器变量。
         /// </summary>
         private System.ComponentModel.Container components = null;
 
         public frmTest()
         {
              //
              // Windows 窗体设计器支持所必需的
              //
              InitializeComponent();
 
              //
              // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
              //
         }
 
         /// <summary>
         /// 清理所有正在使用的资源。
         /// </summary>
         protected override void Dispose( bool disposing )
         {
              if( disposing )
              {
                   if (components != null) 
                   {
                       components.Dispose();
                   }
              }
              base.Dispose( disposing );
         }
 
         #region Windows 窗体设计器生成的代码
         /// <summary>
         /// 设计器支持所需的方法 - 不要使用代码编辑器修改
         /// 此方法的内容。
         /// </summary>
         private void InitializeComponent()
         {
              this.gridShow = new System.Windows.Forms.DataGrid();
              this.domainFunction = new System.Windows.Forms.DomainUpDown();
              this.numM = new System.Windows.Forms.NumericUpDown();
              this.numN = new System.Windows.Forms.NumericUpDown();
              this.btnGo = new System.Windows.Forms.Button();
              this.statusBar1 = new System.Windows.Forms.StatusBar();
              this.panelErrMsg = new System.Windows.Forms.StatusBarPanel();
              ((System.ComponentModel.ISupportInitialize)(this.gridShow)).BeginInit();
              ((System.ComponentModel.ISupportInitialize)(this.numM)).BeginInit();
              ((System.ComponentModel.ISupportInitialize)(this.numN)).BeginInit();
              ((System.ComponentModel.ISupportInitialize)(this.panelErrMsg)).BeginInit();
              this.SuspendLayout();
              // 
              // gridShow
              // 
              this.gridShow.AlternatingBackColor = System.Drawing.Color.Lavender;
              this.gridShow.BackColor = System.Drawing.Color.WhiteSmoke;
              this.gridShow.BackgroundColor = System.Drawing.Color.LightGray;
              this.gridShow.BorderStyle = System.Windows.Forms.BorderStyle.None;
              this.gridShow.CaptionBackColor = System.Drawing.Color.LightSteelBlue;
              this.gridShow.CaptionForeColor = System.Drawing.Color.MidnightBlue;
              this.gridShow.DataMember = "";
              this.gridShow.FlatMode = true;
              this.gridShow.Font = new System.Drawing.Font("Tahoma", 8F);
              this.gridShow.ForeColor = System.Drawing.Color.MidnightBlue;
              this.gridShow.GridLineColor = System.Drawing.Color.Gainsboro;
              this.gridShow.GridLineStyle = System.Windows.Forms.DataGridLineStyle.None;
              this.gridShow.HeaderBackColor = System.Drawing.Color.MidnightBlue;
              this.gridShow.HeaderFont = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold);
              this.gridShow.HeaderForeColor = System.Drawing.Color.WhiteSmoke;
              this.gridShow.LinkColor = System.Drawing.Color.Teal;
              this.gridShow.Location = new System.Drawing.Point(24, 88);
              this.gridShow.Name = "gridShow";
              this.gridShow.ParentRowsBackColor = System.Drawing.Color.Gainsboro;
              this.gridShow.ParentRowsForeColor = System.Drawing.Color.MidnightBlue;
              this.gridShow.ReadOnly = true;
              this.gridShow.SelectionBackColor = System.Drawing.Color.CadetBlue;
              this.gridShow.SelectionForeColor = System.Drawing.Color.WhiteSmoke;
              this.gridShow.Size = new System.Drawing.Size(648, 344);
              this.gridShow.TabIndex = 0;
              // 
              // domainFunction
              // 
              this.domainFunction.BackColor = System.Drawing.SystemColors.Info;
              this.domainFunction.Font = new System.Drawing.Font("宋体", 36F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
              this.domainFunction.ForeColor = System.Drawing.Color.Teal;
              this.domainFunction.Items.Add("C");
              this.domainFunction.Items.Add("A");
              this.domainFunction.Location = new System.Drawing.Point(24, 8);
              this.domainFunction.Name = "domainFunction";
              this.domainFunction.ReadOnly = true;
              this.domainFunction.Size = new System.Drawing.Size(48, 62);
              this.domainFunction.TabIndex = 1;
              this.domainFunction.Text = "C";
              // 
              // numM
              // 
              this.numM.BackColor = System.Drawing.Color.PeachPuff;
              this.numM.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
              this.numM.ForeColor = System.Drawing.Color.Teal;
              this.numM.Location = new System.Drawing.Point(80, 8);
              this.numM.Maximum = new System.Decimal(new int[] {
                                                                            20,
                                                                            0,
                                                                            0,
                                                                            0});
              this.numM.Minimum = new System.Decimal(new int[] {
                                                                            1,
                                                                            0,
                                                                            0,
                                                                            0});
              this.numM.Name = "numM";
              this.numM.Size = new System.Drawing.Size(56, 26);
              this.numM.TabIndex = 4;
              this.numM.Value = new System.Decimal(new int[] {
                                                                         2,
                                                                         0,
                                                                         0,
                                                                         0});
              // 
              // numN
              // 
              this.numN.BackColor = System.Drawing.Color.Bisque;
              this.numN.Font = new System.Drawing.Font("宋体", 12F);
              this.numN.ForeColor = System.Drawing.Color.Teal;
              this.numN.Location = new System.Drawing.Point(80, 40);
              this.numN.Maximum = new System.Decimal(new int[] {
                                                                            25,
                                                                            0,
                                                                            0,
                                                                            0});
              this.numN.Minimum = new System.Decimal(new int[] {
                                                                            1,
                                                                            0,
                                                                            0,
                                                                            0});
              this.numN.Name = "numN";
              this.numN.Size = new System.Drawing.Size(56, 26);
              this.numN.TabIndex = 5;
              this.numN.Value = new System.Decimal(new int[] {
                                                                         4,
                                                                         0,
                                                                         0,
                                                                         0});
              // 
              // btnGo
              // 
              this.btnGo.BackColor = System.Drawing.Color.PaleTurquoise;
              this.btnGo.Location = new System.Drawing.Point(184, 24);
              this.btnGo.Name = "btnGo";
              this.btnGo.Size = new System.Drawing.Size(88, 32);
              this.btnGo.TabIndex = 6;
              this.btnGo.Text = "Go!";
              this.btnGo.Click += new System.EventHandler(this.btnGo_Click);
              // 
              // statusBar1
              // 
              this.statusBar1.Location = new System.Drawing.Point(0, 453);
              this.statusBar1.Name = "statusBar1";
              this.statusBar1.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
                                                                                                         this.panelErrMsg});
              this.statusBar1.ShowPanels = true;
              this.statusBar1.Size = new System.Drawing.Size(704, 32);
              this.statusBar1.TabIndex = 7;
              this.statusBar1.Text = "statusBar1";
              // 
              // panelErrMsg
              // 
              this.panelErrMsg.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents;
              this.panelErrMsg.Text = "Idle";
              this.panelErrMsg.Width = 39;
              // 
              // frmTest
              // 
              this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
              this.ClientSize = new System.Drawing.Size(704, 485);
              this.Controls.Add(this.statusBar1);
              this.Controls.Add(this.btnGo);
              this.Controls.Add(this.numN);
              this.Controls.Add(this.numM);
              this.Controls.Add(this.domainFunction);
              this.Controls.Add(this.gridShow);
              this.MaximizeBox = false;
              this.Name = "frmTest";
              this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
              this.Text = "frmTest";
              ((System.ComponentModel.ISupportInitialize)(this.gridShow)).EndInit();
              ((System.ComponentModel.ISupportInitialize)(this.numM)).EndInit();
              ((System.ComponentModel.ISupportInitialize)(this.numN)).EndInit();
              ((System.ComponentModel.ISupportInitialize)(this.panelErrMsg)).EndInit();
              this.ResumeLayout(false);
 
         }
         #endregion
 
         /// <summary>
         /// 应用程序的主入口点。
         /// </summary>
         [STAThread]
         static void Main() 
         {
              Application.Run(new frmTest());
         }
 
         private void btnGo_Click(object sender, System.EventArgs e)
         {
              int[, ]reslut;
              int m = (int)numM.Value, n = (int)numN.Value;
              
              if (m <= n)
              {
                   panelErrMsg.Text = "Running...";
                   if (domainFunction.Text == "A")                
                       reslut = Combinatorics.Arrange(m, n);
                   else
                       reslut = Combinatorics.Combination(m, n);                        
                   panelErrMsg.Text = "Showing...";
                   gridShow.DataSource = Combinatorics.TwoDemisionIntArrayToDataTable(reslut);
                   panelErrMsg.Text = "Idle";
              }
              else          
                   panelErrMsg.Text = "Input number is invalid";
         }
     }
}
<a hre="http://www.v5v6s.com">百度影音资源</a>
 
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

c#排列组合算法 的相关文章

  • WinForms:如何确定窗口是否不再活动(没有子窗口具有焦点)?

    我的应用程序使用多个窗口 我想隐藏一个特定窗口 以防应用程序失去焦点 当活动窗口不是应用程序窗口时 source https stackoverflow com questions 466354 how can i tell if a wi
  • 为什么libc++的shared_ptr实现使用完整内存屏障而不是宽松内存屏障?

    在boost的实现中shared ptr 它用放松内存排序以增加其引用计数 https github com boostorg smart ptr blob master include boost smart ptr detail sp
  • OpenCv读/写视频色差

    我试图简单地使用 openCV 打开视频 处理帧并将处理后的帧写入新的视频文件 我的问题是 即使我根本不处理帧 只是打开视频 使用 VideoCapture 读取帧并使用 VideoWriter 将它们写入新文件 输出文件看起来比输入更 绿
  • asp.net 文本框文本模式数字,仅允许数字

    我只是想知道 ASP NET 中是否有一种方法只允许文本框中的数字textmode number 当我使用这个时
  • 以编程方式检查页面是否需要基于 web.config 设置进行身份验证

    我想知道是否有一种方法可以检查页面是否需要基于 web config 设置进行身份验证 基本上如果有这样的节点
  • 为什么大多数 C 开发人员使用 Define 而不是 const? [复制]

    这个问题在这里已经有答案了 在许多程序中 define与常量具有相同的用途 例如 define FIELD WIDTH 10 const int fieldWidth 10 我通常认为第一种形式优于另一种形式 它依赖于预处理器来处理基本上是
  • 如何创建可以像 UserControl 一样编辑的 TabPage 子类?

    我想创建一个包含一些控件的 TabPage 子类 并且我想通过设计器来控制这些控件的布局和属性 但是 如果我在设计器中打开子类 我将无法像在 UserControl 上那样定位它们 我不想创建一个带有 UserControl 实例的 Tab
  • 32 位应用程序的特征最大矩阵大小

    所以 我正在寻找Eigen http eigen tuxfamily org index php title Main Page当我尝试声明大于 10000x10000 的矩阵时 包崩溃 我需要声明一个像这样的矩阵 可靠地大约有 13000
  • POCO HTTPSClientSession 发送请求时遇到问题 - 证书验证失败

    我正在尝试使用 POCO 库编写一个向服务器发出 HTTPS 请求的程序 出于测试目的 我正在连接到具有自签名证书的服务器 并且我希望允许客户端进行连接 为了允许这种情况发生 我尝试安装InvalidCertificateHandler这是
  • C++ 异步线程同时运行

    我是 C 11 中线程的新手 我有两个线程 我想让它们同时启动 我可以想到两种方法 如下 然而 似乎它们都没有按照我的预期工作 他们在启动另一个线程之前启动一个线程 任何提示将不胜感激 另一个问题是我正在研究线程队列 所以我会有两个消费者和
  • 从多个类访问串行端口

    我正在尝试使用串行端口在 arduino 和 C 程序之间进行通信 我对 C 编程有点陌生 该程序有多种用户控制形式 每一个都需要访问串口来发送数据 我需要做的就是从每个类的主窗体中写入串行端口 我了解如何设置和写入串行端口 这是我的 Fo
  • 暂停下载线程

    我正在用 C 编写一个非常简单的批量下载程序 该程序读取要下载的 URL 的 txt 文件 我已经设置了一个全局线程和委托来更新 GUI 按下 开始 按钮即可创建并启动该线程 我想要做的是有一个 暂停 按钮 使我能够暂停下载 直到点击 恢复
  • 将数据打印到文件

    我已经超载了 lt lt 运算符 使其写入文件并写入控制台 我已经为同一个函数创建了 8 个线程 并且我想输出 hello hi 如果我在无限循环中运行这个线程例程 文件中的o p是 hello hi hello hi hello hi e
  • 无法将类型“System.IO.Stream”隐式转换为“Java.IO.InputStream”

    我提到了一些类似的问题 但没有一个涉及IO 当我使用时 我在java中使用了相同的代码Eclipse 那次就成功了 但现在我尝试在中使用这段代码Mono for Android C 它不起作用 我正在尝试运行此代码来创建一个InputStr
  • 耐用功能是否适合大量活动?

    我有一个场景 需要计算 500k 活动 都是小算盘 由于限制 我只能同时计算 30 个 想象一下下面的简单示例 FunctionName Crawl public static async Task
  • 当前的 x86 架构是否支持非临时加载(来自“正常”内存)?

    我知道有关此主题的多个问题 但是 我没有看到任何明确的答案或任何基准测量 因此 我创建了一个处理两个整数数组的简单程序 第一个数组a非常大 64 MB 第二个数组b很小 无法放入 L1 缓存 程序迭代a并将其元素添加到相应的元素中b在模块化
  • 剪贴板在 .NET 3.5 和 4 中的行为有所不同,但为什么呢?

    我们最近将一个非常大的项目从 NET Framework 3 5 升级到 4 最初一切似乎都工作正常 但现在复制粘贴操作开始出现错误 我已经成功制作了一个小型的可复制应用程序 它显示了 NET 3 5 和 4 中的不同行为 我还找到了一种解
  • 双精度类型二维多维数组的 pinvoke 编组作为 c# 和 c++ 之间的输入和输出

    我有以下我正在尝试解决的双物质类型的 2d 多维数组的 c 和 c pinvoke 编组 我已经查看了以下热门内容以获得我目前拥有的内容使用双精度数组进行 P Invoke 在 C 和 C 之间编组数据 https stackoverflo
  • 用于 C# XNA 的 Javascript(或类似)游戏脚本

    最近我准备用 XNA C 开发另一个游戏 上次我在 XNA C 中开发游戏时 遇到了必须向游戏中添加地图和可自定义数据的问题 每次我想添加新内容或更改游戏角色的某些值或其他内容时 我都必须重建整个游戏或其他内容 这可能需要相当长的时间 有没
  • 错误:无效使用不完整类型“类 Move”/未定义对 Move::NONE 的引用

    拜托 我不知道为什么这个简单的代码被拒绝 它给了我 2 个编译错误 请帮帮我 I use 代码 块 20 03 我的编译器是GNU GCC 移动 hpp class Move public Move Move int int public

随机推荐

  • GD32F303调试小记(十)之LVGL移植(FreeRTOS)

    一 前言 在上文中 我们成功的移植进了FreeRTOS 接下来我们在此基础上 移入我们的LVGL图形界面库 二 LVGL 一款用于绘制界面UI的开源库 让硬件资源更少的MCU跑出显示效果理想的界面 实际效果可以参考官方或者视频网站上开发者公
  • 【文末送书】2023年以就业为目的学习Java还有必要吗?

    前言 作者主页 雪碧有白泡泡 个人网站 雪碧的个人网站 推荐专栏 java一站式服务 React从入门到精通 前端炫酷代码分享 从0到英雄 vue成神之路 uniapp 从构建到提升 从0到英雄 vue成神之路 解决算法 一个专栏就够了 架
  • Window10安装TensorFlow(GPU)与可行性测试

    2017 11 9遇到坑了 安装成功但是import tensorflow出错正在排查原因 因为在VM的Ubuntu上貌似对GPU支持不怎么好 使用体验不佳 现在尝试直接在Windows10上使用anaconda和pip安装tensorfl
  • view, Window,Activity等概念的比较分析

    1 View 最基本的UI组件 表示屏幕上的一个矩形区域 2 Window 表示一个窗口 不一定有屏幕那么大 可以很大也可以很小 它包含一个View tree和窗口的layout 参数 View tree的root View可以通过getD
  • 数据结构 单链表1

    头文件
  • Kcov - gcov, lcov and bcov

    Short version Kcov a new project of mine for code coverage testing When developing software I ve often found measuring c
  • Vue实现验证码

    在Web应用程序中 为了避免机器自动化或恶意攻击 很常见的做法是要求用户在表单提交之前输入验证码 验证码最常见的形式是图片验证码 因为图片验证码最大程度地防止了自动化机器调用API来执行攻击 使人类用户输入不是人类难以识别的形式 比如文本和
  • 数据结构的常用八种排序算法

    概述 排序有内部排序和外部排序 内部排序是数据记录在内存中进行排序 而外部排序是因排序的数据很大 一次不能容纳全部的排序记录 在排序过程中需要访问外存 我们这里说说八大排序就是内部排序 当n较大 则应采用时间复杂度为O nlog2n 的排序
  • 活动安排问题-贪心算法

    在时间段内选择尽可能多的活动 0 14 include
  • python-10

    纯函数实现面向对象 人狗大战 游戏人狗大战 人 角色 属性 名称 等级 血量 攻击力 性别 职业 zhangsan name zhangsan level 1 hp 100 ad 20 sex 男 职业 魔法师 def person nam
  • QString和std::string相互转换

    QString和std string相互转换 使用下面的函数 toStdString gt 将QString转换成std string QString toStdString fromStdString gt 将std string转换成Q
  • Docker数据目录(/var/lib/docker)迁移

    本文介绍Linux上如何安全的迁移Docker的数据目录 var lib docker 为什么要迁移 虚拟机创建时 一般分配一个比较小的系统盘 然后挂载一个大容量的数据盘 docker默认情况下数据存储在系统盘 var lib docker
  • 捕获线程执行异常

    在 Thread 类中 可以获取线程运行时异常的 API 总共有四个 public void setUncaughtExceptionHandler UncaughtExceptionHandler eh 为某个特定线程指定 Uncaugh
  • hibernate注解

    现在EJB3实体Bean是纯粹的POJO 实际上表达了和Hibernate持久化实体对象同样的概念 他们的映射都通过JDK5 0注释来定义 EJB3规范中的XML描述语法至今还没有定下来 注释分为两个部分 分别是逻辑映射注释和物理映射注释
  • 目标检测一阶段和二阶段对比图

    图片来源
  • 『学Vue2+Vue3』认识Vue3

    认识Vue3 1 Vue2 选项式 API vs Vue3 组合式API 特点 代码量变少 分散式维护变成集中
  • Linux下安装jre

    Linux下安装Java运行环境 现需要项目部署到Linux中 需要配置java运行环境 注 以下测试环境系统为centOS 用户为超级管理员 jre8 1 下载最新版的jre 服务器环境下不需要配置jdk 下载地址如下 http www
  • microsoft visual c++ 6.0中文版两种使用方法

    microsoft visual c 6 0 是一款语言编程软件 那么很多人都不知道microsoft visual c 6 0中文版怎么使用 其实使用方法很简单哦 只要打开microsoft visual c 6 0中文版就可以进行语言编
  • 《数据结构》 图的创建与遍历 代码表示

    测试数据 10 15 共10个顶点 15条边 0 1 0 8 0 0 第一 二个数表示连接两个顶点的起始顶点 第三个数1表示单通行 0表示双向通行 4 8 1 5 4 0 5 9 1 0 6 0 7 3 1 8 3 1 2 5 0 2 1
  • c#排列组合算法

    Combinatorics cs代码清单 using System using System Collections using System Data