We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
All about Apple and Orange appunto
Appunto
The text was updated successfully, but these errors were encountered:
import java.io._ import java.math._ import java.security._ import java.text._ import java.util._ import java.util.concurrent._ import java.util.function._ import java.util.regex._ import java.util.stream._ object Solution { def f(s: Int, t: Int, tree_pos: Int, fruits_pos: Array[Int]) : Int = { (for(a <- fruits_pos) yield { a match { case x if((x+tree_pos)>=s && (x+tree_pos)<=t) => 1 case _ => 0 } }).sum } // Complete the countApplesAndOranges function below. def countApplesAndOranges(s: Int, t: Int, a: Int, b: Int, apples: Array[Int], oranges: Array[Int]) { val tot_a = f(s,t,a,apples) val tot_b = f(s,t,b,oranges) println(tot_a) println(tot_b) } def main(args: Array[String]) { val stdin = scala.io.StdIn val st = stdin.readLine.split(" ") val s = st(0).trim.toInt val t = st(1).trim.toInt val ab = stdin.readLine.split(" ") val a = ab(0).trim.toInt val b = ab(1).trim.toInt val mn = stdin.readLine.split(" ") val m = mn(0).trim.toInt val n = mn(1).trim.toInt val apples = stdin.readLine.split(" ").map(_.trim.toInt) val oranges = stdin.readLine.split(" ").map(_.trim.toInt) countApplesAndOranges(s, t, a, b, apples, oranges) } }
Sorry, something went wrong.
NicolaBernini
No branches or pull requests
Overview
All about Apple and Orange appunto
Appunto
The text was updated successfully, but these errors were encountered: