50 lines
938 B
Bash
Executable File
50 lines
938 B
Bash
Executable File
#!/bin/bash
|
|
function check() {
|
|
input="$(sed -E 's/[0-9][0-9]*/N/g;s/ //g' <<< "$1")"
|
|
if [[ "$input" == *"XXXXX"* ]]; then
|
|
echo 'bingo'
|
|
return
|
|
fi
|
|
for i in {1..5}; do
|
|
if [[ -z "$(cut -c $i <<< "$input" | grep -v X)" ]]; then
|
|
echo 'bingo'
|
|
return
|
|
fi
|
|
done
|
|
}
|
|
function frok() {
|
|
local owo=$j
|
|
local x=0
|
|
for ((i=0; i<${#uwu[@]}; i++)); do
|
|
arr[$owo]=$(sed -E 's/ '"${uwu[$i]}"' / X /g;' <<< "${arr[$owo]}")
|
|
if [[ "$(check "${arr[$owo]}")" == "bingo" ]]; then
|
|
echo "[$owo] bingo! at $i"
|
|
for g in $(sed -E 's/X//g' <<< "${arr[$owo]}"); do
|
|
x=$((x+g))
|
|
done
|
|
echo "[$owo] x*: $((x*${uwu[$i]}))"
|
|
break
|
|
fi
|
|
done
|
|
}
|
|
arr=()
|
|
yarr=()
|
|
|
|
IFS=',' read -a uwu
|
|
read dummy # empty line
|
|
|
|
while read line; do
|
|
read line2
|
|
read line3
|
|
read line4
|
|
read line5
|
|
read dummy
|
|
arr+=(" ${line} "$'\n'" ${line2} "$'\n'" ${line3} "$'\n'" ${line4} "$'\n'" ${line5} "$'\n')
|
|
done
|
|
|
|
for ((j=0; j<${#arr[@]}; j++)); do
|
|
frok &
|
|
done
|
|
|
|
wait
|