串的基本概念字符串:应用在非数值处理、事务处理等领域。
计算机的硬件:主要是反映数值计算的要求。
字符串的处理比具体数值处理复杂。
串(字符串):是零个或多个字符组成的有限序列。记作: S=“a1a2a3…”,其中S是串名,ai(1≦i≦n)是 单个字符,可以是字母、数字或其它字符。串值:双引号括起来的字符序列,引号不属于串的内容。串长:串中所包含的...
分类:
其他好文 时间:
2015-04-29 11:49:27
阅读次数:
184
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpo...
分类:
编程语言 时间:
2015-04-28 22:28:27
阅读次数:
202
这两道题目的类型感觉是一样的 都是利用了容斥的思想 从后往前推然后去重。
HDU 5212 题意 :
给n个数 求出每个数与这n个数分别F(i)的和, F(i) = gcd(a[i], a[j]) * (gcd(a[i], a[j]) - 1).
可以这样考虑 ai与aj互质的时候F()的值是等于0 没必要计算。只要计算以i为gcd的所有的数对的个数 就好了 (1
#include...
分类:
其他好文 时间:
2015-04-27 20:09:01
阅读次数:
139
best code 2015/4/26 第一题,简直水的不行
问题描述
wld有n个数(a1,a2,...,an),他希望进行k次删除一个数的操作,使得最后剩下的n?k个数中有最多的不同的数,保证1≤n≤100,0≤kn,1≤ai≤n(对于任意1≤i≤n)
输入描述
多组数据(最多100组)
对于每组数据:
第一行:一个数n表示数的个数
接下来一行:n个数,依次为a1,a2,...
分类:
其他好文 时间:
2015-04-27 15:19:55
阅读次数:
126
基本思想:在记录的存储地址和它的关键字之间建立一个确定的对应关系;这样,不经过比较,一次存取就能得到所查元素的查找方法。
哈希函数:
在记录的关键字与记录的存储地址之间建立的一种对应关系叫哈希函数。
哈希函数是一种映象,是从关键字空间到存储地址空间的一种映象。可写成:addr(ai) = H(ki) ,其中ii是表...
分类:
其他好文 时间:
2015-04-25 12:14:33
阅读次数:
148
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpo...
分类:
其他好文 时间:
2015-04-25 01:41:00
阅读次数:
133
题目如下:Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two ...
分类:
其他好文 时间:
2015-04-25 00:11:21
阅读次数:
130
就是求$D = A \times B \times A^T - C \times A^T$展开也就是$$D = \sum_{i, j} A_i * A_j * B_{i, j} - \sum_{i} C_i * A_i$$其中$Ai = 0 \ or \ 1$转化成最小割模型,就是一堆东西,选了$i...
分类:
其他好文 时间:
2015-04-24 22:29:08
阅读次数:
202
这题的意思是给你 n 道菜,第 i 道菜需要 Ai 步才能完成每次你能对 m 道菜分别完成一步,请问最少需要几次?这题暴力写肯定是不行的,去年省赛的时候就是没写出来这题,今天再把思路理一理吧。首先我们需要明确的是1. n m ①此时我们不难发现这个现象,如果 sum (A[i]) 能被 m 整除.....
Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of ...
分类:
其他好文 时间:
2015-04-23 23:27:06
阅读次数:
138