Linting
This commit is contained in:
parent
de1375d3f3
commit
4d53ec2b82
@ -19,7 +19,7 @@ function Problem8()
|
|||||||
Find the thirteen adjacent digits in the 1000-digit number that have
|
Find the thirteen adjacent digits in the 1000-digit number that have
|
||||||
the greatest product. What is the value of this product? =#
|
the greatest product. What is the value of this product? =#
|
||||||
|
|
||||||
NUM = """
|
NUM::String = """
|
||||||
73167176531330624919225119674426574742355349194934
|
73167176531330624919225119674426574742355349194934
|
||||||
96983520312774506326239578318016984801869478851843
|
96983520312774506326239578318016984801869478851843
|
||||||
85861560789112949495459501737958331952853208805511
|
85861560789112949495459501737958331952853208805511
|
||||||
@ -42,14 +42,14 @@ function Problem8()
|
|||||||
71636269561882670428252483600823257530420752963450
|
71636269561882670428252483600823257530420752963450
|
||||||
"""
|
"""
|
||||||
|
|
||||||
num = replace(NUM, "\n" => "")
|
num::String = replace(NUM, "\n" => "")
|
||||||
adjacent_digits = 13
|
adjacent_digits::Int16 = 13
|
||||||
target = length(num) - adjacent_digits
|
target::Int32 = length(num) - adjacent_digits
|
||||||
ans, i = 0, 1
|
ans::Int64, i::Int64 = 0, 1
|
||||||
while i < target
|
while i < target
|
||||||
a, j = 1, i
|
a::Int64, j::Int64 = 1, i
|
||||||
while j < (i + adjacent_digits)
|
while j < (i + adjacent_digits)
|
||||||
a = a * parse(Int, (num[j]))
|
a *= parse(Int, (num[j]))
|
||||||
j += 1
|
j += 1
|
||||||
end
|
end
|
||||||
if a > ans
|
if a > ans
|
||||||
|
@ -20,8 +20,8 @@ function Problem9()
|
|||||||
Find the product abc. =#
|
Find the product abc. =#
|
||||||
|
|
||||||
upper_limit = 1000
|
upper_limit = 1000
|
||||||
for a in 1:upper_limit + 1
|
for a = 1:upper_limit+1
|
||||||
for b in a + 1:upper_limit + 1
|
for b = a+1:upper_limit+1
|
||||||
c = upper_limit - a - b
|
c = upper_limit - a - b
|
||||||
if a * a + b * b == c * c
|
if a * a + b * b == c * c
|
||||||
# It is now implied that b < c, because we have a > 0
|
# It is now implied that b < c, because we have a > 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user