题目链接:uva 11423 - Cache Simulator
题目大意;模拟一个cache,4种操作:
ADDR x:访问一个x地址RANGE x y n:访问x + y * k (0≤kSTAT:输出每个大小的cache,MISS的次数END:结束
按照从小到大的顺序给cache的大小。
解题思路:因为访问的次数不会大于1e7次,所以预先处理出访问的序列,然后对于每个...
分类:
其他好文 时间:
2014-08-27 18:49:38
阅读次数:
283
题目链接:uva 1406 - A Sequence of Numbers
题目大意;给定n个数,有两种操作:
Q x:计算与2x取且不为0的数的个数C x:每个数加上x
输出所有Q操作的和。
解题思路:因为x最大为15,所以开16个树状数组,fenx[x]记录的是每个数取模2x+1的情况,然后有一个add值标记总共加了多少。根据add值确定原先数的范围。
#include ...
分类:
其他好文 时间:
2014-08-27 18:47:58
阅读次数:
242
这算是一个演示程序吧,想不到上下文菜单也是採用ON_COMMAND宏来进行消息映射,在这里,我发现一个问题:从CWnd派生的类ON_UPDATE_COMMAND_UI_RANGE似乎没有效果,不知道应该再加点什么,可是从CFrameWnd派生出来问题就不会发生,真是奇怪……看看从CWnd派生出来的效...
分类:
其他好文 时间:
2014-08-27 17:58:48
阅读次数:
234
这里是vector的所有构造方法,成员方法的一些总结,具体的可以详看后面的链接。
public member function
std::vector::assign
C++98
C++11
range (1)
template
void assign (InputIterator first, InputItera...
分类:
其他好文 时间:
2014-08-27 16:39:09
阅读次数:
327
problem: given an array of integers including positive and negative, a target value. find 2 numbers in the array such that the sum of the 2 numbers is...
分类:
其他好文 时间:
2014-08-27 03:53:57
阅读次数:
227
Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2]have the following unique perm...
分类:
其他好文 时间:
2014-08-27 01:37:16
阅读次数:
242
思想: 分三种情况: 1. 当前结点为空,返回0. 2. 叶子结点, 返回当前值. 3. 父结点,返回左右两个 path 值的和。
分类:
其他好文 时间:
2014-08-27 00:22:06
阅读次数:
194
Humble Numbers
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 17407 Accepted Submission(s): 7565
Problem Description
A number w...
分类:
其他好文 时间:
2014-08-26 21:28:16
阅读次数:
296
Description
{p1,..., pk : p1 <
p2 pk} is called a prime
k -tuple of distance s if
p1, p2,..., pk are consecutive prime numbers and
pk - p1 = s . For example, with
k = 4 , s = 8 ,
{11, 13, 1...
分类:
其他好文 时间:
2014-08-26 17:25:13
阅读次数:
217
ROADS
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 10844
Accepted: 3994
Description
N cities named with numbers 1 ... N are connected with one-way roads...
分类:
其他好文 时间:
2014-08-26 17:19:46
阅读次数:
242