Refactoring
This commit is contained in:
parent
90e6ce9490
commit
c3a6144a08
@ -24,10 +24,10 @@ function Problem22()
|
|||||||
What is the total of all the name scores in the file?
|
What is the total of all the name scores in the file?
|
||||||
=#
|
=#
|
||||||
file = "/datos/Scripts/Gitea/Project_Euler/src/files/Problem22.txt"
|
file = "/datos/Scripts/Gitea/Project_Euler/src/files/Problem22.txt"
|
||||||
names = readdlm(file, ',', String)
|
names = sort(readdlm(file, ',', String)[:])
|
||||||
|
|
||||||
result = 0
|
result = 0
|
||||||
for (idx, name) in enumerate(sort(names[1:end]))
|
for (idx,name) in enumerate(names)
|
||||||
result += sum(Int(c) - 64 for c in name) * idx
|
result += sum(Int(c) - 64 for c in name) * idx
|
||||||
end
|
end
|
||||||
return result
|
return result
|
||||||
|
Loading…
x
Reference in New Issue
Block a user