|
|
back to boardNo subject Posted by hess 11 Oct 2008 17:07 I cant undrestand how to count rectangles? pleaze explain it. Re: No subject Let me describe 2nd example of the task. 5 1 2 2 1 3 1 --- We will got this: [ ] [X] [X] [ ] [ ] There is 2 bars 'cause 1 square as well is bar. And it should be counted if it not contents into others longer bars. For example: ---------- 3 4 4 1 2 2 1 3 2 3 3 ----------- [ ][X][ ][ ] [X][ ][ ][ ] [ ][X][X][ ] The right answer will be horizontal: 1+1 = 2 vertical : 1+1 = 2 single blocks: 1+1 = 2 Answer is 6. How to build program? Dont allocate all matrix into memory as i did :))) Sorry for this idiotizm :( So u need to find out the optimal way. The program can be runed and exited with success with 300Kb of mem. I know this way, so i try to put the code here as fast as possible. Re: No subject The problem statement is very ambigous and tricky. Don't like such problems... Program is very easy, but undestanding what is requested by the authors- isn't. Thanks to Nikolai Besschetnov. Your sample saves me. |
|
|