fork(1) download
  1. object Main extends App {
  2. // your code goes here
  3.  
  4. val f:(Seq[Int]=>Boolean)= % =>(1 to%.size)flatMap(%sliding)exists(_.sum==0)
  5.  
  6. println("-=false=-")
  7. println(f(Seq(2,-1)))
  8.  
  9. println("-=true=-")
  10. println(f(Seq(0)))
  11. println(f(Seq(4, -2, -2)))
  12. println(f(Seq(0)))
  13. println(f(Seq(2,2,-3,1,-2,3,1)))
  14. println(f(Seq(2,-1,-1,-1,2,-1,-1)))
  15. println(f(Seq(-2,4,1,-3,2,2,-1,-1)))
  16. println(f(Seq(-4,-1,-1,6,3,6,-5,1,-5,-4,5,3)))
  17. println(f(Seq(-11,8,-2,-6,2,-12,5,3,-7,4,-7,7,12,-1,-1,6,-7,-4,-5,-12,9,5,6,-3)))
  18. println(f(Seq(4,-9,12,12,-11,-11,9,-4,8,5,-10,-6,2,-9,10,-11,-9,-2,8,4,-11,7,12,-5)))
  19.  
  20. }
Success #stdin #stdout 0.19s 322496KB
stdin
Standard input is empty
stdout
-=false=-
false
-=true=-
true
true
true
true
true
true
true
true
true