题目:http://acm.hdu.edu.cn/showproblem.php?pid=5439 题意:按规则构造一个数列a a(1)=1 a(2)=2 a(2)=2 > 写两个2 > a()={1 2 2} a(3)=2 > 写两个3 > a()={1 2 2 3 3} a(4)=3 >写三个4 ...
分类:
其他好文 时间:
2016-09-13 23:56:53
阅读次数:
166
来源:网络 assign: 普通(简单)赋值,一般常用于基本数据类型,常见委托设计模式,一次来防止循环引用。不更改索引计数(Reference Counting)。 对基础数据类型 (NSInteger,CGFloat)和C数据类型(int, float, double, char, 等等) ret ...
分类:
移动开发 时间:
2016-09-11 00:03:23
阅读次数:
352
内存管理 1.什么是ARC? ARC是automatic reference counting自动引用计数,在程序编译时自动加入retain/release。在对象被创建时retain count+1,在对象被release时count-1,当count=0时,销毁对象。程序中加入autorelea ...
分类:
移动开发 时间:
2016-09-09 20:33:43
阅读次数:
231
338.CountingBitsGivenanonnegativeintegernumbernum.Foreverynumbersiintherange0≤i≤numcalculatethenumberof1‘sintheirbinaryrepresentationandreturnthemasanarray.Example:Fornum=5youshouldreturn[0,1,1,2,1,2].题目大意:给一个数字,比如5,那么5之前所有的整数的每个..
分类:
其他好文 时间:
2016-09-02 01:02:18
阅读次数:
113
题意:给定一个n*m的矩阵,让你判断有多少个连通块。 析:用DFS搜一下即可。 代码如下: ...
分类:
其他好文 时间:
2016-08-30 00:09:24
阅读次数:
166
题目大意: 有编号一到t的蚂蚁家族,每个家族有不同的蚂蚁数。 问构成S只蚂蚁到构成B只蚂蚁共有多少种方式 例如 While observing one group, the set of three ant families was seen as {1, 1, 2, 2, 3}, though r ...
分类:
其他好文 时间:
2016-08-29 22:41:37
阅读次数:
221
1049. Counting Ones (30) The task is simple: given any positive integer N, you are supposed to count the total number of 1's in the decimal form of th ...
分类:
其他好文 时间:
2016-08-27 20:40:37
阅读次数:
159
题目链接: http://poj.org/problem?id=1971 Mean: 给定平面上的n个点,求这n个点中能构成平行四边形的个数。 analyse: 由于平行四边形的两条对角线交于一点,且该点为两对角线的中点。若两线段的中点是同一个点,则这两条线段的四个顶点一定可以构成一个平行四边形! ...
分类:
其他好文 时间:
2016-08-23 18:47:05
阅读次数:
126
恢复内容开始 问题描述:给出一个非负整数num,对[0, num]范围内每个数都计算它的二进制表示中1的个数 Example:For num = 5 you should return [0,1,1,2,1,2] 思路:这种题适合归纳法,找出规律然后用编程语言描述,令i从0开始,设f(i)为i对应二 ...
分类:
其他好文 时间:
2016-08-23 01:30:09
阅读次数:
128
Boring counting Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2906 Accepted Submission(s): 1201 ...
分类:
编程语言 时间:
2016-08-21 10:52:32
阅读次数:
185