Skip to content

Instantly share code, notes, and snippets.

@jcchurch
Created September 26, 2013 15:12
Show Gist options
  • Save jcchurch/6715565 to your computer and use it in GitHub Desktop.
Save jcchurch/6715565 to your computer and use it in GitHub Desktop.
My attempt at solving https://icpcarchive.ecs.baylor.edu/external/45/4574.pdf in Lua. This is my first Lua script.
#!/usr/bin/lua
local values = io.read("*number")
while values > 0 do
local currentguess = 0
for i = 1, values do
thisguess = io.read("*number")
if thisguess ~= currentguess then
io.write(string.format("%d ", thisguess))
currentguess = thisguess
end
end
print("$")
-- read values for the next loop
values = io.read("*number")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment