资源简介
找零钱算法 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# 调用win32 api函数-user32.dll详细说明
- C# 调用BarTender打印条码DEMO
- 大型比赛竞赛抽签系统 可打印 c# vs
- C#编写的Gerber查看器
- lua C# .Net4.0 vs2010 LuaInterface
- C#十六进制编辑器
- 明华URF-35H读卡器 C#读写源码 为大家
- C#文件流读取CSV文件
- c#读写PDF文件sql
- C# winform Socket大文件传输
- c#车牌识别系统附30张测试图片
- 《C#面向对象程序设计》源代码(CS)
- 金旭亮《C#面向对象程序设计》教案
- 试题库管理系统毕业论文(C#)源程序
- 学校网站原代码(C#.NET)
- C#-数据库操作技术-员工管理系统
- c#web开发入门经典
- C#与Matlab混合编程的几种方式
- c# 开发与 mysql数据库实现的增删改查
- C#异步操作 异步查询数据库 异步处理
- Basler相机通过IO触发源码
- [源代码] 《领域驱动设计 (C# 2008 实
- 松下PLC与C#通讯串口调试入门教程.z
- USB 继电器控制器 LCUS-1 保证能用 c#
- C# AES加密解密小工具
- C#圆形按钮,非常漂亮动态~~
- [精]C#仿QQ右下角弹出提示框()
- C#进程间通信-共享内存代码
- 有史以来最简单的三层(C#)
- vb调用c#编写的串口DLL文件(vb源码
评论
共有 条评论