今天我们来看一下For表达式中的生成器,定义和过滤等内容。让我们来看下代码def main(args:Array[String]){ val lauren = Persons("Lauren",false) val rocky = Persons("Rocky",true) val vivian =...
分类:
其他好文 时间:
2015-08-17 00:46:33
阅读次数:
210
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define CL(arr, val) memset(arr, val, sizeof(arr))
#define REP(i, n)for((i) = 0...
分类:
其他好文 时间:
2015-08-16 19:55:48
阅读次数:
179
对shell的某些细节还不是十分熟悉,借鉴了好多别人的东西1. Word Frequency 此题很简单,只要能排序就可以 cat words.txt |tr -s " " "\n" sort | unique -c | sort -r | awk '{print $2" "$1}'2.Val...
分类:
系统相关 时间:
2015-08-16 15:10:39
阅读次数:
164
#include#include#include#include#includeusing namespace std;struct node{ int key; node *left, *right;};void insertTree(node* &root,int val){ node* tmp...
分类:
其他好文 时间:
2015-08-16 10:44:47
阅读次数:
122
package com.leegh.dataset/** * @author Guohui Li */object HelloList { def main(args: Array[String]): Unit = { val bigData = List("Hadoop", "Spark"...
分类:
编程语言 时间:
2015-08-16 09:21:02
阅读次数:
119
#include
#include
#define inf 1<<30
using namespace std;
//哈夫曼树实现
//哈夫曼树的特征:如果有n个叶子节点的话,则总结点数为2*n-1。越频繁访问的编码越短
struct node
{
int parent, lson, rson;
int val; //访问次数
};
void createTree(node p...
分类:
其他好文 时间:
2015-08-15 20:02:10
阅读次数:
120
第一个版本:import scala.io.Sourceif(args.length>0){ for(line0){ val lines=Source.fromFile(args(0)).getLines.toList val longestLine=lines.reduceLeft( ...
分类:
其他好文 时间:
2015-08-15 19:42:07
阅读次数:
185
本地存储LocStorage方法:1.appcan.locStorage.getVal(key)获取key保存在localStorage中对应的值//获取保存的colorappcan.locStorage.getVal(‘color‘);//返回保存的颜色值2.appcan.locStorage.setVal(key,Val)要设置的键值对//设置一个color到本地存储中appcan.locStorage.set..
分类:
移动开发 时间:
2015-08-15 18:33:49
阅读次数:
278
题意:插队问题;总结:线段树基础不牢,建树,更新尚不熟悉,注意加强理解记忆。主要理解:(单点更新,逆序插入)发生插队时,前面的队伍是连续没有空位的,即pos:2,1,这种情况不会出现,至少应该为pos:1,2,1插入顺序是逆序的(最后插入的val的位置不会再发生变化),如果正序插入则每个val的顺序...
分类:
其他好文 时间:
2015-08-15 13:13:24
阅读次数:
127
package com.leegh.pattern_match/** * @author Guohui Li */object Option_Internal { def main(args: Array[String]): Unit = { val scores = Map("Alice"...
分类:
其他好文 时间:
2015-08-15 10:13:32
阅读次数:
106