L
Size: a a a
L
CP
CP
CP
S
CP
S
CP
А
S
AM
PR
local case, count
while not case do
print("Write testcase count (number):")
case = tonumber(io.read("*l"))
end
while not count do
print("Write students count (number):")
count = tonumber(io.read("*l"))
end
local coolest = {name = "", score = -math.huge}
for i = 1, count do
local studentname, score
while not studentname do
print("Write " .. i .. " student (name score):")
local line = io.read("*l")
studentname, score = line:match("(%w+).-(%-?%d+%.?%d*)")
if studentname then
score = tonumber(score)
print("Student #" .. i .. ": ", studentname, "score: ", score)
if score > coolest.score then
coolest.name = studentname
coolest.score = score
end
end
end
end
print("Coolest student is ", coolest.name, ", he's score is:", coolest.score)
PR
PR
local case, count
while not case do
print("Write testcase count (number):")
case = tonumber(io.read("*l"))
end
while not count do
print("Write students count (number):")
count = tonumber(io.read("*l"))
end
local coolest = {name = "", score = -math.huge}
for i = 1, count do
local studentname, score
while not studentname do
print("Write " .. i .. " student (name score):")
local line = io.read("*l")
studentname, score = line:match("(%w+).-(%-?%d+%.?%d*)")
if studentname then
score = tonumber(score)
print("Student #" .. i .. ": ", studentname, "score: ", score)
if score > coolest.score then
coolest.name = studentname
coolest.score = score
end
end
end
end
print("Coolest student is ", coolest.name, ", he's score is:", coolest.score)
PR
S
PR
S
PR