信号量(Semaphore)又称为信号量、旗语,它以一个整数变数,提供信号,以确保在并行计算环境中,不同进程在访问共享资源时,不会发生冲突。是一种不需要使用忙碌等待(busy waiting)的一种方法。
信号量的概念是由荷兰计算机科学家艾兹格·迪杰斯特拉(Edsger W. Dijkstra)发明的,广泛的应用于不同的操作系统中。在系统中,给予每一个进程一个信号量,代表每个进程目前的状态,未得...
分类:
编程语言 时间:
2015-08-29 20:14:24
阅读次数:
218
POJ 3046 Ant Counting题目大意:有T个蚂蚁家族,共A个蚂蚁,求元素个数为S到B的集合数刚开始一头雾水,不知道从哪里入手。如何才能不重复计数,这时就用到了DP。定义DP数组,DP[i][j]:用前i种家族形成个数为j的集合数的值;dp[i][j]=∑dp[i-1][j-k](k从0...
分类:
其他好文 时间:
2015-08-28 10:52:41
阅读次数:
145
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 the...
分类:
其他好文 时间:
2015-08-21 23:05:15
阅读次数:
144
Xiao Ming's HopeTime Limit:1000MSMemory Limit:32768KBDescriptionXiao Ming likes counting numbers very much, especially he is fond of counting odd numb...
分类:
其他好文 时间:
2015-08-20 20:36:52
阅读次数:
131
Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones.Your task is counting the segmen...
分类:
其他好文 时间:
2015-08-19 23:17:32
阅读次数:
164
前言最近在看内存管理的东西,需要关掉Xcode的ARC做实验,步骤如下:实现选择project界面,搜索Automatic Reference Counting,改掉BOOl值即可...
分类:
其他好文 时间:
2015-08-19 16:53:44
阅读次数:
107
/*
思路:1.先选三个点
2.去掉同行情况
3.去掉同列情况
4.枚举矩形大小去掉重复情况
*/
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include
#include
#include
#include
#include
#include
#include
#include
#in...
分类:
其他好文 时间:
2015-08-19 16:44:58
阅读次数:
136
Boring counting
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 2253 Accepted Submission(s): 924
Problem Description
035 now fac...
分类:
编程语言 时间:
2015-08-19 01:59:41
阅读次数:
198
11401 - Triangle Counting
Time limit: 1.000 seconds
题意:给你n个线段,长度1-n。问可以组成多少不同的三角形
解题思路:
设最大边长为x的三角形有C(x)个,另外两条边长分别为y和z,根据三角不等式有y+z>x。所以z的范围是x-y
①根据这个不等式,当y=1时x-1
②上面的解包含了y=z的情况...
分类:
其他好文 时间:
2015-08-18 11:52:53
阅读次数:
223
目录:1,自动引用计数的定义2,强引用和弱引用3,类比手动引用4,循环引用5,CoreFoundation内容:自动引用计数的定义:(Automatic Reference Counting) 在编译时自动在合适的位置加入retain 和 release,简化内存管理,自动引用计数不是内存管理,而是...
分类:
其他好文 时间:
2015-08-12 06:36:00
阅读次数:
247