mirror of
https://github.com/mx42/codingame.git
synced 2026-01-14 05:39:51 +01:00
Adding easy puzzles
This commit is contained in:
16
puzzles/easy/the-descent.sh
Normal file
16
puzzles/easy/the-descent.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
# https://www.codingame.com/ide/puzzle/the-descent
|
||||
# Xavier Morel - 2016-03-12
|
||||
|
||||
while true; do
|
||||
mountains=""
|
||||
for (( i=0; i<8; i++ )); do
|
||||
# mountainH: represents the height of one mountain, from 9 to 0.
|
||||
if ((i>0)); then
|
||||
mountains+=";"
|
||||
fi
|
||||
read mountainH
|
||||
mountains+=$mountainH":"$i
|
||||
done
|
||||
|
||||
echo $mountains | tr ";" "\n" | sort -n | tail -n 1 | cut -d ":" -f 2
|
||||
done
|
||||
Reference in New Issue
Block a user