代码示例:packagecom.dt.scala.dataset
objectSet_Map{
defmain(args:Array[String]):Unit={
//Set集合,集合中的数据是不可重复的。但是数据是无序的。
valdataSet=Set(1,2,5,4,1,3,2)
println(dataSet)
valdataSet2=dataSet.+(1)//向集合中添加元素,生成另一个集合
valda..
分类:
其他好文 时间:
2016-02-15 16:41:46
阅读次数:
140
转自:http://www.cnblogs.com/irvinow/archive/2009/02/21/1395340.html 定义二维数组char array[x][y]; 1.只定义个一维的就可以了 char *array; array = new char[x*y]; 访问的时候*(arr
分类:
编程语言 时间:
2016-02-15 10:34:22
阅读次数:
152
问题描述: Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in
分类:
其他好文 时间:
2016-02-14 23:41:02
阅读次数:
286
提取器是从表达式中获取值第27讲中的match代码也是一种提取器defmatch_array(arr:Any)=arrmatch{
caseArray(x)=>println("Array(1):",x)//长度为1的数组,x代表数组中的值
caseArray(x,y)=>println("Array(2):",x,y)//长度为2的数组,x代表数组中的第一个值
caseArray(x,..
分类:
其他好文 时间:
2016-02-14 22:26:37
阅读次数:
311
array_map()的函数原型为:arrayarray_map(callbackcallback,arrayarr1[,array
...])array_map()返回一个数组,该数组包含了arr1中的所有单元经过callback作用过之后的单元。callback接受的参数数目应该和传递给array_map()函数的数组数目一致。callback函数就是array_map所将调..
分类:
编程语言 时间:
2016-02-14 22:23:01
阅读次数:
260
操作的参数不是函数,就是一阶函数我们通过具体的代码来说明:packagecom.dt.scala.dataset
objectListFirstOrderOps{
defmain(args:Array[String]):Unit={
//列表合并,使用:::操作符
println(List(1,2):::List(3,4):::List(5,6))
println(List(1,2):::(List(3,4):::List(5,6)..
分类:
其他好文 时间:
2016-02-14 22:21:57
阅读次数:
203
T1 竞赛排名 分析:模拟 超级大模拟,太弱了,写个模拟都要2个小时。。写的又难看又麻烦。。还需努力 1 var 2 n,i,j,k:longint; 3 t1:real; 4 x,y:array[1..1000,1..9] of real; 5 sum,sumy,s1,s2:array[1..10
分类:
其他好文 时间:
2016-02-14 18:19:16
阅读次数:
226
在scala中使用match表达式进行模式匹配,和其他语言中的switch语句的功能类型。但是match的功能更强大我们先看一个简单的例子objectHelloPatternMatch{
defmain(args:Array[String]):Unit={
vardata:Int=1
datamatch{
case1=>println("one")
case2=>println("two")
case..
分类:
其他好文 时间:
2016-02-14 15:37:37
阅读次数:
187
geQuestion: Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Given nums = [-2, 0, 3, -5,
分类:
其他好文 时间:
2016-02-14 10:17:48
阅读次数:
179
<html> <head> <meta http-equiv="content-type" content="text/html" charset="UTF-8"> <script type="text/javascript" > var picArr=new Array("1.jpg","2.jp
分类:
其他好文 时间:
2016-02-14 01:38:29
阅读次数:
284