GO Solution For UVa 10309 - Turn the Lights Off. In this post we will see how we can solve this challenge in GoLang for UVa Online Judge.

Problem Description

Since we all rely on mother earth, it’s our duty to save her. Therefore, you’re now asked to save energy by switching lights off.

A friend of yours has the following problem in his job. There’s a grid of size 10x10, where each square has a light bulb and a light switch attached to it. Unfortunately

...

You can find the full details of the problem Turn the Lights Off at UVa Online Judge

Sample Input

all_off
##########
##########
##########
##########
##########
##########
##########
##########
##########
##########
all_on
OOOOOOOOOO
OOOOOOOOOO
OOOOOOOOOO
OOOOOOOOOO
OOOOOOOOOO
OOOOOOOOOO
OOOOOOOOOO
OOOOOOOOOO
OOOOOOOOOO
OOOOOOOOOO
simple
#O########
OOO#######
#O########
####OO####
###O##O###
####OO####
##########
########O#
#######OOO
########O#
end

Sample Output

all_off 0
all_on 44
simple 4

Solution: Please check the main.go snippet for the solution.

Solution originally posted at: Github by @codingsince1985