Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 251f526

Browse files
committed
Problem 8
1 parent 57de399 commit 251f526

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
object Solution {
2+
3+
val in = {
4+
val lines = scala.io.Source.stdin.getLines
5+
lines flatMap (_ split ' ' filter (_.nonEmpty))
6+
}
7+
8+
def nextInt = in.next.toInt
9+
10+
def main(args: Array[String]): Unit = {
11+
val testCount = nextInt
12+
for (test <- 1 to testCount) {
13+
val N, K = nextInt
14+
val digits = in.next map (_.asDigit)
15+
val products = digits.sliding(K) map (_.product)
16+
println(products.max)
17+
}
18+
}
19+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /