Advertisement
31ph4n70m

minimun_of_two.lua

Nov 20th, 2019
602
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.46 KB | None | 0 0
  1. -- lua solution to codabbey challenge 4
  2. function split(s, delimiter)
  3.     result = {};
  4.     for match in (s..delimiter):gmatch("(.-)"..delimiter) do
  5.       table.insert(result, match);
  6.     end
  7.     return result;
  8. end
  9.  
  10. inp = io.read()
  11. b = {}
  12. c = {}
  13. for i=1,inp do
  14.     a = split(io.read(), " ")
  15.     for k, v in pairs(a) do
  16.     table.insert(b,v)
  17.     end
  18.   table.insert(c, b)
  19. end
  20. d = inp*2
  21. for i=1,d,2 do
  22.   print(math.min(tonumber(c[1][i]), tonumber(c[1][i+1])))
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement