资源简介
找零钱算法 C#实现

代码片段和文件信息
using Common;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btn_Click( object sender EventArgs e )
{
// 获取输入
int total = Convert.ToInt32( tbTotal.Text );
var strs = tbElements.Text.Split( new string[ ] { ““ } StringSplitOptions.None );
List elems = new List();
foreach( var str in strs )
{
var n = Convert.ToInt32( str );
elems.Add( n );
}
var num = Convert.ToInt32( tbNumOfSolutions.Text );
var stopwatch = new System.Diagnostics.Stopwatch();
stopwatch.Start(); // 开始监视代码运行时间
tbRet.Text = “正在求解... ...“;
// 计算
var ret = MumberDecompose.Decompose( total elems num );
stopwatch.Stop(); // 停止监视
TimeSpan timespan = stopwatch.Elapsed; // 获取当前实例测量得出的总时间
var Elapsed = timespan.TotalMilliseconds;
ShowRet( ret Elapsed );
}
void ShowRet( List> ret double Elapsed )
{
string str = ““;
str += “耗时:“ + Elapsed.ToString() + “ 毫秒“ + “\r\n \r\n“ ;
str += “解个数:“ + ret.Count.ToString() + “\r\n \r\n“;
var sb = new StringBuilder();
foreach ( var s in ret )
{
var sb2 = new StringBuilder();
foreach ( var e in s )
{
sb2.Append( e );
sb2.Append( “ + “ );
}
sb2.Remove( sb2.Length - 3 3 );
sb2.Append( “\r\n“ ) ;
sb.Append( sb2.ToString() );
}
str += sb.ToString();
tbRet.Text = str;
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-06-22 11:27 WindowsFormsApplication1\
目录 0 2017-06-22 11:27 WindowsFormsApplication1\.vs\
目录 0 2017-06-22 11:27 WindowsFormsApplication1\.vs\WindowsFormsApplication1\
目录 0 2017-06-22 11:27 WindowsFormsApplication1\.vs\WindowsFormsApplication1\v14\
文件 53248 2017-06-22 14:02 WindowsFormsApplication1\.vs\WindowsFormsApplication1\v14\.suo
目录 0 2017-06-22 13:53 WindowsFormsApplication1\WindowsFormsApplication1\
文件 1039 2017-06-22 11:27 WindowsFormsApplication1\WindowsFormsApplication1.sln
文件 189 2017-06-22 11:27 WindowsFormsApplication1\WindowsFormsApplication1\App.config
目录 0 2017-06-22 12:51 WindowsFormsApplication1\WindowsFormsApplication1\bin\
目录 0 2017-06-22 11:55 WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\
文件 12288 2017-06-22 12:51 WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe
文件 189 2017-06-22 11:27 WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe.config
文件 24064 2017-06-22 12:51 WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.pdb
文件 22696 2017-06-22 12:51 WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe
文件 189 2017-06-22 11:27 WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.config
文件 490 2017-03-19 05:00 WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.manifest
目录 0 2017-06-23 01:30 WindowsFormsApplication1\WindowsFormsApplication1\bin\Release\
文件 11776 2017-06-23 00:00 WindowsFormsApplication1\WindowsFormsApplication1\bin\Release\WindowsFormsApplication1.exe
文件 189 2017-06-22 11:27 WindowsFormsApplication1\WindowsFormsApplication1\bin\Release\WindowsFormsApplication1.exe.config
文件 24064 2017-06-23 00:00 WindowsFormsApplication1\WindowsFormsApplication1\bin\Release\WindowsFormsApplication1.pdb
文件 22696 2017-06-23 01:29 WindowsFormsApplication1\WindowsFormsApplication1\bin\Release\WindowsFormsApplication1.vshost.exe
文件 189 2017-06-22 11:27 WindowsFormsApplication1\WindowsFormsApplication1\bin\Release\WindowsFormsApplication1.vshost.exe.config
文件 490 2017-03-19 05:00 WindowsFormsApplication1\WindowsFormsApplication1\bin\Release\WindowsFormsApplication1.vshost.exe.manifest
文件 5439 2017-06-23 01:30 WindowsFormsApplication1\WindowsFormsApplication1\bin\Release\WindowsFormsApplication1.zip
文件 2299 2017-06-22 13:53 WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs
文件 6834 2017-06-22 13:23 WindowsFormsApplication1\WindowsFormsApplication1\Form1.Designer.cs
文件 5817 2017-06-22 13:23 WindowsFormsApplication1\WindowsFormsApplication1\Form1.resx
文件 2167 2017-06-22 13:52 WindowsFormsApplication1\WindowsFormsApplication1\MumberDecompose.cs
目录 0 2017-06-22 12:51 WindowsFormsApplication1\WindowsFormsApplication1\obj\
目录 0 2017-06-22 12:51 WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\
文件 868 2017-06-22 11:27 WindowsFormsApplication1\WindowsFormsApplication1\obj\Debug\DesignTimeResolveAssemblyReferences.cache
............此处省略33个文件信息
- 上一篇:C#做的俄罗斯方块,功能还可以
- 下一篇:C#—上位机——数据波形显示
相关资源
- C#解析HL7消息的库135797
- C# OCR数字识别实例,采用TessnetOcr,对
- 考试管理系统 - C#源码
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
- C#自定义控件
评论
共有 条评论