如题,要求速度最快,算法最好。
解决方案 »
- 求c#一个正则表达式
- 这个问题如何解决?谢谢各位大哥
- 在Microsoft Visual Studio .NET 2003中做c++为什么#include "iostream.h"就出错呀??
- 为什么这个TIMER报这样的错呢?
- 有没有工具可以看到c#中各个线程的相关信息和线程使用CPU的状况?
- 请教c#文件共享问题!?
- 如何把公司的公用组件dll制作成安装文件,安装过程中自动注册到机器中?
- 谁知道这个东西,可以介绍下吗?SqlMapper.cs这个文件
- WebBrowser 怎么调用JS 打开winform窗体
- 请问各位大侠,在C#中如何使用WM_COPY消息传递一个结构体,能给出源码就更加感激不尽了,谢谢。
- 怎么在水晶报表里添加类字段???求解~
- VS2010,c#+sql链接的问题,请各位老师帮忙看下。
sqlserver,两张表
t1, id, 初始化为(0-999999)
t2, num, 随机生成6位数字select t1.id, isnull(t.count, 0) as count from t1
left join (select num, count(*) as count from t2 group by num) t
on t.num = t1.id
order by t.count好了,按出现次数排序了兄弟难道是卖彩票的?
我写到数据库中,就简单啦。一个表,一个min就搞定了。
nCount sixnum
1 676829
2 312312
我不写入数据库中呢?还有我不是卖彩票的,我是买彩票的。
int[] bitmap = new int[1000000];
foreach (int x in yourdata)
{
bitmap[x]++;
}
int result = bitmap.Select((x, i) => new { x, i }).OrderBy(x => x.x).First().i;
watch.Start();
watch.Stop();
watch.Elapsed;
{
Random r = new Random();
Hashtable ht = new Hashtable();
long maxNum = 1000; for (long i = 0; i < maxNum; i++)
{
string temp;
temp = "";
for (int j = 0; j < 6; j++)
{
temp += r.Next(0, 9).ToString();
} string KV;
if (ht.ContainsKey(temp))
{
KV = ht[temp].ToString().Substring(0, ht[temp].ToString().IndexOf('_'));
KV = (Convert.ToSByte(KV)+1).ToString()+"_" + temp; ht[temp] = KV;
}
else
{
KV = "1_"+temp;
ht.Add(temp, KV);
}
}
ArrayList arrList = new ArrayList(ht.Values);
arrList.Sort();
txtResults.Text = arrList[0].ToString(); string rTemp = "";
for (int i = 0; i < arrList.Count; i++)
{
rTemp = rTemp + arrList[i].ToString()+'\n'; }
rtxt1.Text = rTemp;
}