在scala中可以将if/else表达式的值赋值给一个变量 例如: val s = if(x > 0) 1 else o
var sum = 0;
val s == "hello"
for(i //until 方法返回一个并不包含上限的区间
sum += s(i)
也可以不需要使用下标
var sum = 0
for(ch <- "Hello") sum += ch
每...
分类:
其他好文 时间:
2015-08-19 16:47:52
阅读次数:
125
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3...
分类:
其他好文 时间:
2015-08-19 00:30:45
阅读次数:
126
Coins in a Line IIIThere arencoins in a line. Two players take turns to take a coin from one of the ends of the line until there are no more coins lef...
分类:
其他好文 时间:
2015-08-19 00:09:26
阅读次数:
247
Given a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is like:3 + ...
分类:
其他好文 时间:
2015-08-18 16:05:11
阅读次数:
164
Given a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is like:3 + ...
分类:
编程语言 时间:
2015-08-17 19:08:01
阅读次数:
117
Add DigitsGiven a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is...
分类:
其他好文 时间:
2015-08-17 18:44:52
阅读次数:
130
题目:Given a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is like:3...
分类:
其他好文 时间:
2015-08-17 13:31:52
阅读次数:
97
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3...
分类:
其他好文 时间:
2015-08-17 13:28:39
阅读次数:
120
Add Digits
Given a non-negative integer num, repeatedly add all its digits until the
result has only one digit.
For example:
Given num = 38, the process is like: 3
+ 8 = 11, 1 + 1 = 2. ...
分类:
其他好文 时间:
2015-08-17 12:11:37
阅读次数:
104
Given a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is like:3 + ...
分类:
其他好文 时间:
2015-08-17 10:00:19
阅读次数:
111