Advertisement
paranid5

8 08.11

Nov 7th, 2021
1,100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.71 KB | None | 0 0
  1. private infix fun Boolean.arrow(other: Boolean) = !(this && !other)
  2.  
  3. fun main() {
  4.     var cnt = 0
  5.     val letters = listOf('K', 'P', 'O', 'B', 'I')
  6.  
  7.     letters.forEach { f ->
  8.         val l1 = letters - f
  9.  
  10.         l1.forEach { s ->
  11.             val l2 = l1 - s
  12.  
  13.             l2.forEach { t ->
  14.                 val l3 = l2 - t
  15.  
  16.                 l3.forEach { fo ->
  17.                     val l4 = l3 - fo
  18.  
  19.                     l4.forEach { fi ->
  20.                         "$f$s$t$fo$fi"
  21.                             .takeIf { it.first() != 'I' && "IO" !in it && "OI" !in it }
  22.                             ?.let { cnt++ }
  23.                     }
  24.                 }
  25.             }
  26.         }
  27.     }
  28.  
  29.     println(cnt)
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement