WA1
Послано
Eustas 21 авг 2008 12:37
Trying to solve this simple problem and always get WA1. Tried to read input by chars/by lines. Tried to output with endline and without...
Got some questions.
What is correct answer for:
3 3
###
#.#
###
...and for:
3 3
###
###
###
...is such input correct:
3 3
#.#
...
#.#
May be i'm on wrong way - my algo is - create a list of leaves of tree; delete them and increment counter; repeat until leaves list is empty. answer is doubled counter - 1 or doubled counter if one vertex left in tree.