This is the simple version of Shortest Code series. If you need some challenges, please try the [challenge version](http://www.codewars.com/kata/570f45fab29c705d330004e3)

## Task:

There is a rectangular land and we need to plant trees on the edges of that land.

I will give you three parameters:

```width``` and ```length```, two integers > 1 that represents the land's width and length;

```gaps```, an integer >= 0, that is the distance between two trees.

Return how many trees have to be planted, if you can't achieve a symmetrical layout(see Example 3) then return 0. 
    
### Example: 

```
    
    Example1:
    width=3, length=3, gaps=1       o - o
    we can plant 4 trees            -   -
    sc(3,3,1)=4                     o - o
    
    Example2:
    width=3, length=3, gaps=3       o - -
    we can plant 2 trees            -   -
    sc(3,3,3)=2                     - - o
    
    Example3:
    width=3, length=3, gaps=2       o - -
    if we plant 2 trees, some       x   o
    gaps of two trees will >2       x x x
                                    
    if we plant 3 trees, some       o - -
    gaps of two trees will <2       x   o
    so we can not finish it         o - -
    sc(3,3,2)=0                         
    
    Example4:
    width=7, length=7, gaps=3       o - - - o - -
    we can plant 6 trees            -           -
    sc(3,3,3)=6                     -           o
                                    -           -
                                    o           -
                                    -           -
                                    - - o - - - o
    
    some corner case:
    
    Example5:
    width=3, length=3, gaps=0       o o o
    we can plant 8 trees            o   o
    sc(3,3,0)=8                     o o o
    
    Example6:
    width=3, length=3, gaps=10      o 1 2
    in this case, the max gaps      1   3
    of two trees is 3               2 3 o
    gaps=10 can not finished
    so sc(3,3,10)=0
                                    
```
    
### Series:
 - [Bug in Apple](http://www.codewars.com/kata/56fe97b3cc08ca00e4000dc9)
 - [Father and Son](http://www.codewars.com/kata/56fe9a0c11086cd842000008)
 - [Jumping Dutch act](http://www.codewars.com/kata/570bcd9715944a2c8e000009)
 - [Planting Trees](http://www.codewars.com/kata/5710443187a36a9cee0005a1)
 - [Give me the equation](http://www.codewars.com/kata/56fe9b65cc08cafbc5000de3)
 - [Find the murderer](http://www.codewars.com/kata/570f3fc5b29c702c5500043e)
 - [Reading a Book](http://www.codewars.com/kata/570ca6a520c69f39dd0016d4)
 - [Eat watermelon](http://www.codewars.com/kata/570df12ce6e9282a7d000947)
 - [Special factor](http://www.codewars.com/kata/570e5d0b93214b1a950015b1)
 - [Guess the Hat](http://www.codewars.com/kata/570ef7a834e61306da00035b)
 - [Symmetric Sort](http://www.codewars.com/kata/5705aeb041e5befba20010ba)
 - [Are they symmetrical?](http://www.codewars.com/kata/5705cc3161944b10fd0004ba)
 - [Max Value](http://www.codewars.com/kata/570771871df89cf59b000742)
 - [Trypophobia](http://www.codewars.com/kata/56fe9ffbc25bf33fff000f7c)
 - [Virus in Apple](http://www.codewars.com/kata/5700af83d1acef83fd000048)
 - [Balance Attraction](http://www.codewars.com/kata/57033601e55d30d3e0000633)
 - [Remove screws I](http://www.codewars.com/kata/5710a50d336aed828100055a)
 - [Remove screws II](http://www.codewars.com/kata/5710a8fd336aed00d9000594)
 - [Regular expression compression](http://www.codewars.com/kata/570bae4b0237999e940016e9)
 - [Collatz Array(Split or merge)](http://www.codewars.com/kata/56fe9d579b7bb6b027000001)
 - [Tidy up the room](http://www.codewars.com/kata/5703ace6e55d30d3e0001029)
 - [Waiting for a Bus](http://www.codewars.com/kata/57070eff924f343280000015)

Source: codewars | Difficulty: EASY
Tags: Game theory

Ad-hoc

Starter code: def sc(width,length,gaps):
	

Solutions:
def sc(width, length, gaps):
	(a, b) = divmod(2 * width + 2 * length - 4, gaps + 1)
	return 0 if b else a


def sc(width, length, gaps):
	places = width * 2 + (length - 2) * 2
	if gaps == 0:
		return places
	(div, mod) = divmod(places, gaps + 1)
	if mod:
		return 0
	return div


def sc(w, l, g):
	return int((2 * w + 2 * (l - 2)) / (1 + g)) if (2 * w + 2 * (l - 2)) % (1 + g) == 0 else 0


def sc(w, l, g):
	return [0, (2 * (w + l) - 4) // (g + 1)][(2 * (w + l) - 4) % (g + 1) == 0]


def sc(width, length, gaps):
	land = 2 * (width - 1) + 2 * (length - 1)
	(d, m) = divmod(land, gaps + 1)
	return 0 if m else d


def sc(width, length, gaps):
	edges = (width + length - 2) * 2
	(q, r) = divmod(edges, gaps + 1)
	return q * (not r)


def sc(w, l, g):
	n = (2 * w + 2 * (l - 2)) / (g + 1)
	return not n % 1 and n


def sc(width, length, gaps):
	perimeter = 2 * (width + length - 2)
	(trees, remainder) = divmod(perimeter, gaps + 1)
	return remainder == 0 and trees


def sc(width, length, gaps):
	n = 2 * (length + (width - 2))
	return n / (gaps + 1) if n % (gaps + 1) == 0 else 0


def sc(w, l, g):
	return 0 if (2 * w + 2 * l - 4) % (g + 1) != 0 else (2 * w + 2 * l - 4) / (g + 1)