Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,21 @@
|
|||
go =>
|
||||
List = [455,999,1990,1999,2000,2001,2008,2009,2010,2011,2012,1666,3456,3888,4000],
|
||||
foreach(Val in List)
|
||||
printf("%4d: %w\n", Val, roman_encode(Val))
|
||||
end,
|
||||
nl.
|
||||
|
||||
roman_encode(Val) = Res =>
|
||||
if Val <= 0 then
|
||||
Res := -1
|
||||
else
|
||||
Arabic = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1],
|
||||
Roman = ["M", "CM", "D", "CD", "C", "XC","L","XL","X","IX","V","IV","I"],
|
||||
Res = "",
|
||||
foreach(I in 1..Arabic.length)
|
||||
while(Val >= Arabic[I])
|
||||
Res := Res ++ Roman[I],
|
||||
Val := Val - Arabic[I]
|
||||
end
|
||||
end
|
||||
end.
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
go2 =>
|
||||
All = [Len=I=roman_encode(I) : I in 1..4000,E=roman_encode(I), Len=E.len].sort_down,
|
||||
println(All[1..2]),
|
||||
nl.
|
||||
Loading…
Add table
Add a link
Reference in a new issue