31ph4n70m

Funny_Words_Generator.dart

Dec 16th, 2019
528
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 0.81 KB | None | 0 0
  1. // dart solution to codeabbey challenge 72
  2. import 'dart:io';
  3. void main() {
  4.     var INP1 = stdin.readLineSync().split(" ").map((elem) => int.parse(elem)).toList();
  5.     var INP2 = stdin.readLineSync().split(" ").map((elem) => int.parse(elem)).toList();
  6.     var RSP = [];
  7.     var CON = "bcdfghjklmnprstvwxz";
  8.     var VOW = "aeiou";
  9.     var A = 445;
  10.     var C = 700001;
  11.     var M = 2097152;
  12.     var XN = INP1[1];
  13.     var LI = 0;
  14.     for (var i = 0; i < INP1[0]; i++){
  15.         var WORD = "";
  16.         for (var j = 1; j <= INP2[i]; j++){
  17.             XN = (A*XN + C) % M;
  18.             if(j % 2 == 0){
  19.                 LI = XN % 5;
  20.                 WORD += VOW[LI];
  21.             }else{
  22.                 LI = XN % 19;
  23.                 WORD += CON[LI];
  24.             }
  25.         }
  26.         RSP.add(WORD);
  27.     }
  28.     print(RSP.join(" "));
  29. }
Add Comment
Please, Sign In to add comment