This is a problem from a training contest of the UPC Programming
Conest<http://concurs.lsi.upc.edu/>
.

I have been thinking of it a lot and I can't find the solution.

Any ideas?

  In the game of chess, a pawn is a piece that only threatens two squares,
namely the two diagonally in front of it (if these squares exist). For
instance, in this example board with five rows and seven columns, the pawn
at c4 threatens b3 and d3, the pawn at a2 only threatens b1, the pawn at g5
only threatens f4, and the pawn at e1 threatens no square. (In a real chess
game no pawn can appear at the first or last row, but we forget that rule
here.)

Now, given the number of rows *R* and the number of columns *C* of the
board, can you compute *Pawns(R, C)*, the number of ways to place *R* pawns
in the board such that all the pawns but one threatens exactly another pawn
and all the pawns but one is threatened exactly by another pawn?
InputEach line of input has two integers *R* (1 ≤ *R* ≤ 50) and *C* (1
≤ *C*≤ 50) with the dimensions of the board.
OutputFor each input line, print a line with *R*, *C* and *Pawns(R, C)*. You
can assume that the decimal representation of *Pawns(R, C)* requires less
than 18 digits. Sample Input

1 9
4 2
5 7

Sample Output

1 9 9
4 2 2
5 7 74

*Author:* Salvador Roura





Thanks,

Albert

-- 
OuFeRRaT
http://ouferrat.blogspot.com/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

<<inline: peons.png>>

Reply via email to