一、 基本简介ARC是自iOS 5/Mac OS X
10.7之后增加的新特性,消除了原先手动管理内存的烦琐,编译器会自动在适当的地方插入适当的retain、release、autorelease语句。你不再需要担心内存管理,因为编译器为你处理了一切ARC
是编译器特性,而不是 iOS 运行时特性,...
分类:
其他好文 时间:
2014-05-09 15:28:11
阅读次数:
367
一、问题
用XCODE5新建工程,COPY老工程代码,编译出现以下错误:
ARC forbids explicit message send of 'release'
二、解决
工程-->"Build Settings"-->找到Objective-C Automatic Reference Counting项-->将它的值设置为NO。
再次编...
分类:
其他好文 时间:
2014-05-09 06:23:39
阅读次数:
285
什么是assign,copy,retain之间的区别?assign:
简单赋值,不更改索引计数(Reference Counting)。copy:
建立一个索引计数为1的对象,然后释放旧对象retain:释放旧的对象,将旧对象的值赋予输入对象,再提高输入对象的索引计数为1retain是指针拷贝,co...
分类:
其他好文 时间:
2014-05-09 00:08:47
阅读次数:
419
Boring CountingTime Limit: 3000ms Memory limit:
65536K有疑问?点这里^_^题目描述 In this problem you are given a number sequence P
consisting of N integer and Pi....
分类:
其他好文 时间:
2014-05-08 19:17:31
阅读次数:
473
《算法导论》里的COUNTING_SORT,用C++实现有问题:
#include
#include
using namespace std;
void COUNTING_SORT(vectorint>&A, vectorint>&B, const int& k)
{
int* C = new int[k + 1]();
for (unsigned j = 0; j A.size();...
分类:
其他好文 时间:
2014-05-07 02:59:30
阅读次数:
251
题目链接:http://acm.upc.edu.cn/problem.php?id=2224题意:给出n个数pi,和m个查询,每个查询给出l,r,a,b,让你求在区间l~r之间的pi的个数(A#include
#include #include #include #define lson rt>1;...
分类:
其他好文 时间:
2014-05-06 08:53:03
阅读次数:
248
Problem DescriptionGiven n integers.You have two
operations:U A B: replace the Ath number by B. (index counting from 0)Q A B:
output the length of the...
分类:
其他好文 时间:
2014-05-06 01:20:33
阅读次数:
332
1004. Counting Leaves (30)
分类:
其他好文 时间:
2014-05-06 00:25:24
阅读次数:
340
Counting TrianglesTime Limit: 2000/1000 MS
(Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s):
2012Accepted Submission(s): 966P...
分类:
其他好文 时间:
2014-05-01 21:10:35
阅读次数:
388
题目链接:11401 - Triangle Counting
题意:有1,2,3....n的边,求最多能组成的三角形个数。
思路:利用三角形不等式,设最大边为x,那么y + z > x 得 x - y
然后y取取值,可以从1取到x - 1,y为n时候,有n - 1个解,那么总和为0 + 1 + 2 +...+ (x - 2) = (x - 1) * ( x- 2) / 2;
然后扣除掉重...
分类:
其他好文 时间:
2014-05-01 17:16:56
阅读次数:
284