Back
Close

Aqueduct builder

Statement

 Goal

A Roman architect asks you to use your coding skills to build an aqueduct. An aqueduct has a layer of bricks (#) over which water runs (o). It has a given height, width, and the supports are columns of bricks 2 wide and are spaced by a width of gap characters. At the end, the water flows over and down to the bottom. A support should only be built if both characters can fit without exceeding the width, otherwise it would block the water on its way down!
Input
Line 1: An integer, width, representing the width of the aqueduct
Line 2: An integer, height, representing the height of the aqueduct
Line 3: An integer, gap, representing the spacing of the supports
Output
An aqueduct with the given specifications
Constraints
8 <= width <= 100
2 <= height <= 20
1 <= gap <= width / 2
Example
Input
20
5
8
Output
ooooooooooooooooooooo
####################o
##        ##        o
##        ##        o
##        ##        o
##        ##        o
##        ##        o

Game modes
Fastest, Shortest

Test cases
Simple and small Test
Input
20 5 8
Output
ooooooooooooooooooooo ####################o ## ## o ## ## o ## ## o ## ## o ## ## o

Different support width Validator
Input
20 5 6
Output
ooooooooooooooooooooo ####################o ## ## ## o ## ## ## o ## ## ## o ## ## ## o ## ## ## o

Tall but thin Test
Input
10 20 5
Output
ooooooooooo ##########o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o

A bit wider Validator
Input
11 20 5
Output
oooooooooooo ###########o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o

No supports past the end Test
Input
19 8 7
Output
oooooooooooooooooooo ###################o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o ## ## o

A bit wider Validator
Input
28 8 7
Output
ooooooooooooooooooooooooooooo ############################o ## ## ## o ## ## ## o ## ## ## o ## ## ## o ## ## ## o ## ## ## o ## ## ## o ## ## ## o

Lots of supports Test
Input
22 4 3
Output
ooooooooooooooooooooooo ######################o ## ## ## ## ##o ## ## ## ## ##o ## ## ## ## ##o ## ## ## ## ##o

Different width Validator
Input
21 4 3
Output
oooooooooooooooooooooo #####################o ## ## ## ## o ## ## ## ## o ## ## ## ## o ## ## ## ## o

Solution language

Solution

Stub generator input