码迷,mamicode.com
首页 > 其他好文
使用联合类型
使用联合类型   可以在 C# 中使用联合类型,但是,由于 C# 没有真正意义上的联合类型,因此,在 C# 中使用看上去不漂亮。在这一节,我们将讨论如何在 C# 中使用联合类型,以及作为库设计人员,如何可以决定库是否公开联合类型(虽然,我个人建议避免跨语言公开联合类型)。 第一个例子,我们定义了一个简单的联合类型Quantity,它有两个构造函数,一个包含整数,另一个包含浮点数;还提供一个函...
分类:其他好文   时间:2014-06-24 18:21:48    阅读次数:217
HDU 1050 Moving Tables
HDU数学题...
分类:其他好文   时间:2014-06-25 20:02:22    阅读次数:220
使用 F# 列表
使用 F# 列表   在 C# 中使用 F# 的列表,是完全可能的,但是,我建议不要用,因为,只要再做一点,就会使事情在 C# 看来更加自然。例如,把列表转换成数组很简单,用List.toArray 函数;转换成System.Collections.Generic.List,用 new ResizeArray()构造函数;转换成System.Collections.Generic.IEnume...
分类:其他好文   时间:2014-06-24 22:05:13    阅读次数:318
屌丝程序员赚钱之道目录
打算写一些程序赚钱的文章,这个都是我自己做过或者正在做的经验,希望能够对大家有益处,能够多多少少加快屌丝们变成高富帅,走上事业巅峰,达到人生高潮,迎娶白富美之路。 屌丝程序员赚钱之道之屌丝前传 屌丝程序员赚钱之道 之APP 屌丝程序员赚钱之道之投资 屌丝程序员赚钱之道之taobao 屌丝程序员赚钱之道之威客 屌丝程序员赚钱之道之电子书 屌丝程序员赚钱之道之网络 屌丝程序...
分类:其他好文   时间:2014-06-24 17:36:04    阅读次数:129
Dreamhost 提示No input file specified. 的解决办法
如果开启FastCGI模式,.htaccess无法生效,一直提示no input file specified。 因为在Fastcgi模式下,php不支持rewrite的目标网址的PATH_INFO的解析  ThinkPHP运行在URL_MODEL=2时,会出现 No input file specified.的情况,  这时可以修改网站目录的.htaccess文件:(by default7...
分类:其他好文   时间:2014-06-25 00:23:53    阅读次数:209
LeetCode: Best Time to Buy and Sell Stock II [122]
【题目】 Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one and sell one share of the stock multiple times). H...
分类:其他好文   时间:2014-06-24 19:40:53    阅读次数:240
LeetCode: Best Time to Buy and Sell Stock III [123]
【题目】 Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete at most two transactions. Note: You may not engage in multiple transactions at the same time (i...
分类:其他好文   时间:2014-06-24 23:28:43    阅读次数:223
LeetCode: Binary Tree Maximum Path Sum [124]
【题目】 Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. For example: Given the below binary tree, 1 / 2 3 Return 6. 【题意】 给定一棵二叉树,找出其中路径和最大的路径,然会返回最大路径和。 本题中的路径不是从根节点到叶子节点这样的传统的路...
分类:其他好文   时间:2014-06-24 20:42:59    阅读次数:268
LeetCode: Valid Palindrome [125]
【题目】 Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example, "A man, a plan, a canal: Panama" is a palindrome. "race a car" is not a palindrome. Note: Have you consider that the string m...
分类:其他好文   时间:2014-06-24 15:35:07    阅读次数:150
POJ 1475 Pushing Boxes
搜索这种东西只要写之前规划得当还是蛮顺手的。。 mark[x1][y1][x2][y2]表示小人在(x1,y1) 盒子在(x2,y2)这种状态是否到过。 剩下的就是优先队列 + bfs 了,另外开一个栈记录前驱以输出路径。 #include #include #include #include #include #include #include #include #incl...
分类:其他好文   时间:2014-06-24 23:18:20    阅读次数:159
tcp_recvmsg 函数详解
linux内核关于tcp_recvmsg的实现详解...
分类:其他好文   时间:2014-06-24 19:49:53    阅读次数:301
排序算法比较和选择
排序算法有不少,当然,一般的语言中都提供某个排序函数,比如Python中,对list进行排序,可以使用sorted(或者list.sort()),关于这方面的使用,在我的github代码库algorithm中有几个举例,有兴趣的看官可以去那里看看(顺便告知,我在Github中的账号是qiwsir,欢迎follow me)。但是,在某些情况下,语言中提供的排序方法或许不适合,必须选择某种排序算法。 ...
分类:其他好文   时间:2014-06-24 18:33:33    阅读次数:205
NYOJ 915 +-字符串
+-字符串 时间限制:1000 ms  |  内存限制:65535 KB 难度:1 描述Shiva得到了两个只有加号和减号的字符串,字串长度相同。Shiva一次可以把一个加号和它相邻的减号交换。他想知道最少需要多少次操作才能把第一个字符串变换成第二个字符串。你现在要去帮助他完成那个这个问题。 输入多组测试数据 每组数据有两行,每行包含一个由”+”和”-“最...
分类:其他好文   时间:2014-06-24 20:57:17    阅读次数:142
创建.m文件一片空白的错误解决方案
今天写代码,想继承一个类,突然发现创建的类文件一片空白,如图 之后各种调试发现都解决不了问题,以为是装了xcode6 beta2 版本的问题,结果发现其实是我创建错了 我创建的是 差点删了2个xcode....让我去死一会儿吧......
分类:其他好文   时间:2014-06-24 17:33:26    阅读次数:166
7 如何检查一个数字是不是2的乘方
bool result = false; result = CheckPowerOfTwo(8); Console.WriteLine(result.ToString()); static bool CheckPowerOfTwo(ulong number) { ...
分类:其他好文   时间:2014-06-25 20:05:36    阅读次数:141
8 break 和 Continue 之间的区别
break: 直接跳出循环 continue:中断本次循环,继续进行下一次循环 static void breakvsContinue() { for (int i = 0; i < 10; i++) { if (i == 0) break; DoSo...
分类:其他好文   时间:2014-06-24 22:09:06    阅读次数:234
LeetCode:Subsets II
Given a collection of integers that might contain duplicates, S, return all possible subsets. Note: Elements in a subset must be in non-descending order.The solution set must not contain duplica...
分类:其他好文   时间:2014-06-24 20:58:32    阅读次数:230
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!