//单元测试通过
/**
*四舍五入并保留N位小数
*
*@paramnumber数值字符串
*@paramafterPoint第几位小数
*
*@return处理后结果
*/
+(NSString*)halfUpDecimalNumber:(NSString*)numberafterPoint:(int)position
{
/*
Mode的枚举类型
NSRoundPlain,//四舍五入
NSRoundDown,//只舍..
分类:
编程语言 时间:
2015-06-10 01:26:24
阅读次数:
218
java se5中添加了协变返回类型,他表示在到处类中的被覆盖方法可以返回基类方法的返回类型的某种导出类型class Grain(){public String toStinrg(){return "Grain";}}class Wheat extends Grain(){public String...
分类:
其他好文 时间:
2015-06-10 01:05:16
阅读次数:
115
Givens1,s2,s3, find whethers3is formed by the interleaving ofs1ands2.For example,Given:s1="aabcc",s2="dbbca",Whens3="aadbbcbcac", return true.Whens3="...
分类:
其他好文 时间:
2015-06-10 00:59:36
阅读次数:
110
头像由彩色变灰色有两种实现方式:
方法1把图片彩色图转换为纯黑白二色:
/**
* 将彩色图转换为纯黑白二色
*
* @param 位图
* @return 返回转换好的位图
*/
private Bitmap convertToBlackWhite(Bitmap bmp) {
int width = bmp.getWidth(); // 获取位图的宽
int...
分类:
其他好文 时间:
2015-06-09 23:45:54
阅读次数:
242
1 int dp[1000000]; 2 class Solution { 3 public: 4 int rob(vector& nums) { 5 int i,n=nums.size(); 6 if(n==0) 7 return ...
分类:
其他好文 时间:
2015-06-09 23:28:50
阅读次数:
123
No.118 Pascal's TriangleGivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1],...
分类:
其他好文 时间:
2015-06-09 23:28:36
阅读次数:
118
String.prototype.Trim = function(){ return this.replace(/^\s+/g,"").replace(/\s+$/g,""); } function JSCookie(){ this.GetCookie = function(key){ va...
分类:
Web程序 时间:
2015-06-09 23:26:50
阅读次数:
120
Browser 对象window对象表示浏览器中打开的窗口如果文档包含框架(iframe 或 iframe标签),浏览器会为HTML文档创建一个window对象,并为每个框架创建一个额外的window对象window对象集合 frames[] 返回窗口中所有命名的框架,return Ar...
分类:
其他好文 时间:
2015-06-09 23:25:49
阅读次数:
104
No.118 Pascal's Triangle ||Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].思路: 生成帕斯卡三角形第rowIndex+1行....
分类:
其他好文 时间:
2015-06-09 23:25:11
阅读次数:
105
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr...
分类:
编程语言 时间:
2015-06-09 23:09:15
阅读次数:
141