37,741
社区成员
发帖
与我相关
我的任务
分享line = io.read()
for i = 0,#line do
io.write(line:sub(#line - i,#line - i))
endline = io.read("*line")
year = line:sub(1,4)
month = line:sub(6,7)
t = os.date("*t",os.time{year = year,month = month,day = 1})
print(t.yday)for a = 0,9 do
for b = 0,9 do
for c = 0,9 do
if 100*a+10*b+c+100*c+10*a+b == 3200 then
print("a = ",a,",b = ",b,",c = ",c)
end
end
end
endfunction split(str,delim)
local i,j,k
local t = {}
k = 1
while true do
i,j = string.find(str,delim,k)
if i == nil then
table.insert(t,string.sub(str,k))
return t
end
table.insert(t,string.sub(str,k,i - 1))
k = j + 1
end
end
line = io.read("*line")
t = split(line,",")
local iMax,iMin,indMax,indMin
if t ~= nil then
iMax = tonumber(t[1])
indMax = 1
iMin = tonumber(t[1])
indMin = 1
for x in pairs(t) do
if iMax < tonumber(t[x]) then
iMax = tonumber(t[x])
indMax = x
end
if iMin > tonumber(t[x]) then
iMin = tonumber(t[x])
indMin = x
end
end
end
print("Max ",iMax,",index ",indMax)
print("Min ",iMin,",index ",indMin)n = io.read("*number")
assert(n > 1 and n < 300)
d = os.time{year = 2012,month=1,day=n}
print(os.date("%m-%d",d))
str = io.read("*line")
print(str:sub(#str))t = {}
math.randomseed(os.clock())
for i=1,10 do
t[i] = math.random(1,500)
end
io.write('Number list :')
for i in pairs(t) do
io.write(t[i],'\t')
end
iMax = 0
for i in pairs(t) do
if t[i] > iMax then
iMax = t[i]
end
end
print()
print('Max : ',iMax)
print()