和vector一样,map也可以看作一种特殊的数组,vector是不限定长度的数组,map是可以不开中间位置元素空间的数组。map常见的函数:m.insert(pair) //插入一对数据
m.size() //返回容器中元素的个数
m.count(key) //返回key键是否出现过
m.find(key) //寻找key键元素,返回到迭代器
m.erase(pos)...
分类:
其他好文 时间:
2015-08-06 22:30:49
阅读次数:
173
#include
char map[8][8];
int visited,flag;
int n,i,j,m;
void dfs(int x,int y)
{
if( x=n || y>=m)
return;
if(map[x][y]!='.')
return;
if(flag)
...
分类:
其他好文 时间:
2015-08-06 22:24:52
阅读次数:
161
CodeForces 567C. Geometric Progression(map 数学啊)...
分类:
其他好文 时间:
2015-08-06 22:18:36
阅读次数:
142
题目传送门 1 /* 2 题意:问选出3个数成等比数列有多少种选法 3 map:c1记录是第二个数或第三个数的选法,c2表示所有数字出现的次数。别人的代码很短,思维巧妙 4 */ 5 /************************************************ ...
分类:
其他好文 时间:
2015-08-06 22:11:02
阅读次数:
99
Polycarp loves geometric progressions very much. Since he was only three years old, he loves only the progressions of length three. He also has a favo...
分类:
其他好文 时间:
2015-08-06 21:54:13
阅读次数:
104
class Solution {
public:
vector twoSum(vector& nums, int target)
{
vector twoSum1(2);
map mValueIdex;
map::iterator it;
bool flag=0;
for(int i=0;i<nums.size();i++)
{
//两个一样.
if(num...
分类:
其他好文 时间:
2015-08-06 20:30:36
阅读次数:
108
/*
* Map集合的两种存取方式:
* 1.keySet:将map中所有的键存入到Set集合,因为set具备迭代器。
* 所有可以迭代方式取出所有的键,再根据get方法,获取每一个键对应的值。
* 原理:Map集合的取出原理,将map集合转化成set集合,通过迭代器取出。
*/
import java.util.HashMap;
import java.util.Map;...
分类:
其他好文 时间:
2015-08-06 20:28:35
阅读次数:
226
---恢复内容开始---Ognl默认是从“根”中取数据的下面Demo中用的是Ognl.getValue(String expression, Map context, Object root)这个方法。 // 参数1,填写Ognl表达式 // 参数2,Map类=》context上下文 // 参数.....
分类:
其他好文 时间:
2015-08-06 16:34:53
阅读次数:
169
1 首先说一下工作原理:
在map阶段,使用job.setInputFormatClass定义的InputFormat将输入的数据集分割成小数据块splites,同时InputFormat提供一个RecordReder的实现。本例子中使用的是TextInputFormat,他提供的RecordReder会将文本的一行的行号作为key,这一行的文本作为value。这就是自定义Map的输入是的...
分类:
编程语言 时间:
2015-08-06 15:12:54
阅读次数:
187
Map map = new HashMap();
for(int i=0;i<100;i++){
map.put(i+"", i+"");
}
//遍历值
System.out.println("遍历值");
for(String value : map.values()){
System.out.println(value);
}
//遍...
分类:
其他好文 时间:
2015-08-06 15:07:52
阅读次数:
78