数据表记录包含表索引和数值。请对表索引相同的记录进行合并,合并后表记录为相同索引表的数值求和先输入键值对的个数然后输入成对的index和value值,以换行符隔开输出合并后的键值对(多行)4 0 1 0 2 1 2 3 40 3 1 2 3 4思路:用一个map字典来做,每次输入一对时count下,...
分类:
其他好文 时间:
2015-08-14 21:21:06
阅读次数:
444
今天闲来无事,做了三道leetcode水题,怒更两发博客,也挺不错。今天更新的两篇都是dp解法的简单题。
题目要求如下。
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, giv...
分类:
其他好文 时间:
2015-08-14 19:06:57
阅读次数:
193
简单题hdu2063题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2063过山车Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total S...
分类:
编程语言 时间:
2015-08-14 13:30:11
阅读次数:
155
下面是AC代码 1 #include 2 #include 3 #include 4 using namespace std; 5 6 7 vector jishu(string& str) 8 { 9 int len=str.size();10 vector vec;11 ...
分类:
其他好文 时间:
2015-08-14 13:10:39
阅读次数:
116
Seam Carving
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 956 Accepted Submission(s): 382
Problem Description
Fish likes to...
分类:
其他好文 时间:
2015-08-14 10:02:30
阅读次数:
171
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1800
这道题目是道哈希的简单题,主要难度在于怎样将问题抽象画。
对于每一组数据,我要求它最少需要几把扫帚。
我们把2 4 5 6 4这组输入排序,变成了2 4 4 5 6,每一次取最长的一个递增序列,取的次数就是我们需要的答案,请仔细想想,若输入为2 4 5 6,那我们只需要一...
分类:
其他好文 时间:
2015-08-12 19:20:41
阅读次数:
163
UVA - 11021 - Tribles题目传送:TriblesAC代码:#include
#include
#include
#include
#include
#include
#include
#include
#include
#include <cst...
分类:
其他好文 时间:
2015-08-12 14:44:37
阅读次数:
130
ZOJ - 2083 - Win the Game题目传送:Win the Game最近正在慢慢体会博弈里面的SG函数的意义此题是最简单的SG博弈问题,只需打个表就OK了AC代码:#include
#include
#include
#include
#include
#include
#include <stac...
分类:
其他好文 时间:
2015-08-10 14:53:58
阅读次数:
103
Big Number
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 6015 Accepted Submission(s): 4205
Problem Description
As we know, Big Number is...
分类:
其他好文 时间:
2015-08-10 09:28:24
阅读次数:
114
kmp简单题 找循环节。由于KMP的next[]数组,所以可以考虑最后一组的情况,及next[n]的值;n-next[n]的值表示一个循环节。如果n%(n-next[n])!=0表明该循环不成立。不然就是直接得到。#include#include#define maxn 1000010int nex...
分类:
其他好文 时间:
2015-08-08 22:34:45
阅读次数:
122