dp[dep][ex][sta]表示长度为dep的,前面出现过的数的集合为ex,不满足要求的数字的集合为sta的满足要求的数的个数 1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 ll dp[20] ...
分类:
其他好文 时间:
2016-05-13 09:16:30
阅读次数:
132
对于4139,支点为3,(4-2)*4+(3-2)*1+(2-2)*3+(1-2)*9=0 dp[dep][sum][zzz]表示长度为dep,之前的权值为sum,支点为zzz的平衡数的个数 枚举支点求值 注意0的情况 1 #include<bits/stdc++.h> 2 using namesp ...
分类:
其他好文 时间:
2016-05-13 08:50:40
阅读次数:
176
Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example:Given num = 16, return true. Given num = 5, return fa ...
分类:
编程语言 时间:
2016-05-13 08:24:17
阅读次数:
142
Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or ...
分类:
其他好文 时间:
2016-05-13 07:23:33
阅读次数:
219
最近在学习数据结构感觉利用二进制位来标记一个数是否存在是特别节省空间的,比如位图和布隆过滤器是效率比较高的。所以感觉有必要复习一下二进制位的一些常用的操作。通过几个例子来复习一下:(一)写一个函数返回参数二进制中1的个数(与运算)intcount_one_bits(size_tvalu..
分类:
其他好文 时间:
2016-05-13 05:19:23
阅读次数:
161
因为 ObjC 的 runtime 只能在 Mac OS 下才能编译,所以文章中的代码都是在 Mac OS,也就是 x86_64 架构下运行的,对于在
arm64 中运行的代码会特别说明。
在上一篇分析 isa 的文章从
NSObject 的初始化了解 isa中曾经说到过实例方法被调用时,会通过其持有 isa 指针寻找对应的类,然后在其中的 class_data_bits_t...
分类:
其他好文 时间:
2016-05-13 00:09:53
阅读次数:
296
#includeusing namespace std;
/*
/*
* CS:APP Data Lab
*
*
*
* bits.c - Source file with your solutions to the Lab.
* This is the file...
分类:
其他好文 时间:
2016-05-12 20:37:35
阅读次数:
791
Power of Four
My Submissions
Question
Editorial Solution
Total Accepted: 12339 Total
Submissions: 36888 Difficulty: Easy
Given an integer (signed 32 bits), write a function to...
分类:
其他好文 时间:
2016-05-12 11:43:16
阅读次数:
150
Number of 1 Bits
My Submissions
Question
Editorial Solution
Total Accepted: 90511 Total
Submissions: 240977 Difficulty: Easy
Write a function that takes an unsigned integer and...
分类:
其他好文 时间:
2016-05-12 11:41:43
阅读次数:
146
dp[dep][four]表示长度为dep的上一个是否为4的不含子串49的数的个数 1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 ll dp[20][2]; 5 int dig[20]; 6 ll ...
分类:
其他好文 时间:
2016-05-11 21:32:41
阅读次数:
185