Last active
January 10, 2019 10:11
-
-
Save seliverstov-maxim/ee5fe89101d8000ba7b376efc472e87f to your computer and use it in GitHub Desktop.
Найти площадь луж
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def calc(map) | |
| .... | |
| end | |
| def assert(map, res) | |
| puts calc(map) == res ? 'Ok' : 'False' | |
| end | |
| assert([4,3,2,1,1,2,3], 6) | |
| assert([1,2,2,3,5,5,6], 0) | |
| assert([6,5,5,3,2,2,1], 0) | |
| assert([1,3,1,2,3,1], 3) | |
| assert([2,5,1,2,3,4,7,7,6,7,2,4], 13) | |
| assert([2,3,6,5,2,3,5,2,4,7,6], 15) | |
| assert([2,5,1,2,3,4,7,7,6,7], 11) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
для
[1,2,2,3,5,5,6]луж не будет, площадь = 0для
[1,3,1,2,3,1]площадь луж будет = 3для
[2,3,6,5,2,3,5,2,4,7,6]площадь луж будет = 15