Advertisement
31ph4n70m

Funny_Words_Generator.kt

Dec 16th, 2019
553
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.76 KB | None | 0 0
  1. // kotlin solution to codeabbey challenge 72
  2.  
  3. fun main(args: Array<String>) {
  4.     var INP1 = readLine()!!.split(" ").map { it.toInt() }
  5.     var INP2 = readLine()!!.split(" ").map { it.toInt() }
  6.     var CON = "bcdfghjklmnprstvwxz"
  7.     var VOW = "aeiou"
  8.     var A = 445
  9.     var C = 700001
  10.     var M = 2097152
  11.     var XN = INP1[1]
  12.     var LI = 0
  13.     var RSP = mutableListOf<String>()
  14.     for (wl in INP2){
  15.         var WORD = ""
  16.         for (i in 1 until wl+1){
  17.             XN = (A*XN + C) % M
  18.             if (i % 2 == 0){
  19.                 LI = XN % 5
  20.                 WORD += VOW[LI]
  21.             }else{
  22.                 LI = XN % 19
  23.                 WORD = WORD + CON[LI]
  24.             }
  25.         }
  26.         RSP.add(WORD)
  27.     }
  28.     println(RSP.joinToString(" "))
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement