Created
December 2, 2020 23:07
-
-
Save mattk42/cd6d404900135ab750b1cc3c0d2dc883 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
inputs="$(<$1)" | |
while read i | |
do | |
inputs="`echo "$inputs" | sed 1d`" | |
while read x | |
do | |
while read z | |
do | |
sum=$(($x + $i + $z)) | |
if [ $sum -eq 2020 ] | |
then | |
echo $(($x * $i *$z)) | |
exit 0 | |
fi | |
done <<< $inputs | |
done <<< $inputs | |
done <<< $inputs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment