Adding Grid Lines With linewidths
Brindle & Co's dense activity grids were coming out as one solid block of colour, so the design team added a hairline between neighbouring cells. The printer charges by the number of cells on the page, and the quote has to go out before anyone has looked at the grid itself.
Task: Print how many cells the grid contains.
Input
The first line holds two integers separated by a single space: how many rows the grid has, then how many columns, each between 1 and 100. Then come that many rows, each holding that many numbers separated by single spaces.
Output
One line holding a whole number, with no decimal point: how many cells the grid has in total. Every cell counts, whatever value it holds.
Example:
Input:
3 4
1 2 3 4
5 6 7 8
9 10 11 12
Output:
12
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in