Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner
- object Main extends App
- {
- case class Foo(me: Int, nums: Array[Int], com: String)
- {
- val poss = new Array[Boolean](nums.length)
- for (i <- 0 until poss.length)
- poss(i) = true
- def disqualify(index: Array[Int]) = index.foreach(i =>
- {
- poss(i) = false
- foos.foreach(f => if (f.nums(i) == nums(i) && f.me != me) f.disqualify_internal(i))
- })
- def disqualify_internal(index: Int) = poss(index) = false
- def disp =
- {
- print(s"Set ${if (me < 10) me + " " else me}: ")
- println(poss.zipWithIndex.map((f: (Boolean, Int)) => if (f._1) nums(f._2) else " ").mkString(" ") + "\t" + com)
- }
- }
- val foos = Array(
- Foo(0, "2321386104303845".toCharArray.map(_.toString.toInt), "0 correct"),
- Foo(1, "5616185650518293".toCharArray.map(_.toString.toInt), "2 correct"),
- Foo(2, "3847439647293047".toCharArray.map(_.toString.toInt), "1 correct"),
- Foo(3, "5855462940810587".toCharArray.map(_.toString.toInt), "3 correct"),
- Foo(4, "9742855507068353".toCharArray.map(_.toString.toInt), "3 correct"),
- Foo(5, "4296849643607543".toCharArray.map(_.toString.toInt), "3 correct"),
- Foo(6, "3174248439465858".toCharArray.map(_.toString.toInt), "1 correct"),
- Foo(7, "4513559094146117".toCharArray.map(_.toString.toInt), "2 correct"),
- Foo(8, "7890971548908067".toCharArray.map(_.toString.toInt), "3 correct"),
- Foo(9, "8157356344118483".toCharArray.map(_.toString.toInt), "1 correct"),
- Foo(10, "2615250744386899".toCharArray.map(_.toString.toInt), "2 correct"),
- Foo(11, "8690095851526254".toCharArray.map(_.toString.toInt), "3 correct"),
- Foo(12, "6375711915077050".toCharArray.map(_.toString.toInt), "1 correct"),
- Foo(13, "6913859173121360".toCharArray.map(_.toString.toInt), "1 correct"),
- Foo(14, "6442889055042768".toCharArray.map(_.toString.toInt), "2 correct"),
- Foo(15, "2326509471271448".toCharArray.map(_.toString.toInt), "2 correct"),
- Foo(16, "5251583379644322".toCharArray.map(_.toString.toInt), "2 correct"),
- Foo(17, "1748270476758276".toCharArray.map(_.toString.toInt), "3 correct"),
- Foo(18, "4895722652190306".toCharArray.map(_.toString.toInt), "1 correct"),
- Foo(19, "3041631117224635".toCharArray.map(_.toString.toInt), "3 correct"),
- Foo(20, "1841236454324589".toCharArray.map(_.toString.toInt), "3 correct"),
- Foo(21, "2659862637316867".toCharArray.map(_.toString.toInt), "2 correct")
- )
- val in = new Scanner(System.in)
- while (true)
- {
- println(" 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15")
- foos.foreach(f => f.disp)
- println("Eliminate something:")
- val s = in.nextLine
- val tar = s.split(" ")(0).toInt
- val toRemove = s.split(" ")(1)
- foos(tar).disqualify(if (toRemove.equals("all")) (0 to 15).toArray else toRemove.split(",").map(_.toInt))
- println("\n\n")
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement