summaryrefslogtreecommitdiff
path: root/1/part2.f95
blob: b3d6bd2fe997cd141062670516984b6c83c2462a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
program day1
    implicit none

    integer, parameter :: input_len = 200
    integer, parameter :: search = 2020

    integer :: i, j, k
    integer, dimension(input_len) :: input

    open(10, file='input', status='old')
    do i = 1, input_len
        read(10, *) input(i)
    end do
    close(10)

    do i = 1, input_len
        do j = 1, input_len
            do k = 1, input_len
                if (input(i) + input(j) + input(k) == search) then
                    print *, input(i) * input(j) * input(k)
                    stop
                end if
            end do
        end do
    end do

end program day1