Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // D solution to codabbey challenge 72
- import std.stdio;
- import std.array;
- import std.conv;
- import std.algorithm;
- void main() {
- int[] INP1 = readln().split().map!(v => v.to!int).array();
- int[] INP2 = readln().split().map!(v => v.to!int).array();
- string[] RSP;
- string CON = "bcdfghjklmnprstvwxz";
- string VOW = "aeiou";
- int A = 445;
- int C = 700001;
- int M = 2097152;
- int XN = INP1[1];
- int LI = 0;
- for (int i = 0; i < INP1[0]; i++){
- string WORD = "";
- for (int j = 1; j <= INP2[i]; j++) {
- XN = (A*XN + C) % M;
- if(j % 2 == 0){
- LI = XN % 5;
- WORD ~= VOW[LI];
- }else{
- LI = XN % 19;
- WORD ~= CON[LI];
- }
- }
- RSP ~= WORD;
- }
- writeln(join(RSP, " "));
- }
Add Comment
Please, Sign In to add comment