# How Many Paint Tins Do I Need?

Take in 3 inputs. The length of the wall, the height of the wall and the coverage of the paint. Output how many tins of paint are required.

# Output

Since there's no way to purchase 1/3 tin of paint, you'll need to round the amount of paint tins up to the nearest integer.

# Assumptions/Stipulations

• Only 1 coat of paint is required
• Round up in terms of paint tins required

# Test Cases

Length: 20 meters | Height: 7 meters | Coverage: 12 meters = 12 tins of paint

Input Output
1/1/10 1
5/5/10 3
2/3/8 1
5/8/8 5
45/5/18 13
20/7/12 12
1/1/1 1
200/10/14 143

## Current Winners! (28th November 2023)

Jelly - 3 bytes - Jonathan Allan https://codegolf.stackexchange.com/a/267131/91342

Uiua - 3 bytes - chunes https://codegolf.stackexchange.com/a/267109/91342

Vyxal 3 - 3 bytes - Nick Kennedy https://codegolf.stackexchange.com/a/267138/91342

APL - 3 bytes - Tbw https://codegolf.stackexchange.com/a/267134/91342

Vyxal - 3 bytes - Iyxal https://codegolf.stackexchange.com/a/267112/91342

• -1 because this isn’t interesting in the slightest. I really recommend you wait for feedback in the Sandbox before posting a challenge. Nov 27, 2023 at 12:22
• @noodleman Perhaps, but I'm happy with the turnout in terms of answers :-)I thought about making each input be a different unit, so meters, meters squared, feet, inches, miles etc and making them convert but I think it would all boil down to the shortest conversion for all answers so I chose to omit. Let me know you're thoughts! Nov 27, 2023 at 14:08
• That idea seems to fall into a common challenge-writing trap of combining many not-directly-related sub tasks and just stacking them on top of each other. I can’t think of a more interesting variant of this challenge, but that’s not to say one doesn’t exist. Don’t feel too discouraged if you write a few poorly-received challenges before you write one that clicks; just please wait for feedback in the Sandbox for future ideas. If you don’t get any feedback, you can bring your post up in the site’s chatroom The Nineteenth Byte (see footer) Nov 27, 2023 at 17:56
• @noodleman Appreciate the information, thank you very much :-) I'll make sure to use the sandbox in future to vet questions Nov 28, 2023 at 9:08
• Showing only the "3 bytes winners" doesn't make much sense. We emphasize competition within each language, and this is what this leaderboard snippet does. Nov 29, 2023 at 9:01

# Jelly, 3 bytes

P÷Ċ


A monadic Link that accepts the dimensions on the left and the paint tin coverage on the right and yields the number of tins required.

Try it online!

### How?

P÷Ċ - Link: Dimensions, Coverage
P   - product {Dimensions}
÷  - divide by {Coverage}
Ċ - ceiling


# Uiua,  4  3 bytes

⌈×÷


Try it!

-1 thanks to alephalpha

Takes input in the order coverage length height

⌈×÷
÷  # divide first two args
×   # multiply by third
⌈    # ceiling

• You can do ⌈×÷, and take input in the order coverage length height. Nov 28, 2023 at 1:53

# Vyxal 3, 3 bytes

÷×⌈


Try it Online!

Similar to most other answers. Divide by coverage, multiply by other dimension, take ceiling.

# APL (Dyalog Classic), 3 bytes

⌈÷/


Try it online!

Written as a tacit function that takes a vector with entries length, coverage, and height, in that order.

÷/, read as Divide Reduce, calculates length ÷ coverage ÷ height. Since APL evaluates right to left, this gives length ÷ (coverage ÷ height) = (length × height) ÷ coverage. ⌈ takes the ceiling of the result.

# APL+WIN, 6 bytes

Prompts for three numbers. Coverage followed by wall dimensions:

⌈⎕×⎕÷⎕


Try it online! Thanks to Dyalog Classic

# Arturo, 15 bytes

$=>[ceil//&*&&]  Try it! $=>[ceil//&*&&]
$=>[ ] ; a function &*& ; multiply first arg by second // & ; divide by third ceil ; ceiling  # Scala 3, 20 bytes (l,h,c)=>(l*h+c-1)/c  Attempt This Online! # Charcoal, 8 bytes Ｉ±÷×ＮＮ±Ｎ  Try it online! Link is to verbose version of code. Explanation: Port of @SevC_10's Python answer.  Ｎ First input as a number × Multiplied by Ｎ Second input as a number ÷ Integer divided by Ｎ Third input as a number ± Negated ± Negated Ｉ Cast to string Implicitly print  # Retina 0.8.2, 39 bytes .+$*
1(?=1*¶(1+)¶)
$1 (1+)(?=1*¶1+¶\1)  Try it online! Takes input on separate lines but link is to test suite that splits on commas for convenience. Explanation: .+$*


Convert to unary.

1(?=1*¶(1+)¶)
$1  Multiply only the first number by the second. (1+)(?=1*¶1+¶\1)  Partition the first number into as few values as possible that do not exceed the third number and output the size of the partition. # JavaScript (Node.js), 22 bytes (a,b,c)=>(a*b+c-1)/c|0  Try it online! # JavaScript (Node.js), 20 bytes suggested by Arnauld (x,y,z)=>~-(x*y+z)/z  Try it online! • 20 bytes with BigInts. Nov 27, 2023 at 10:50 • x*y-~z wouldn't be the same as x*y+~-z ? Nov 27, 2023 at 11:39 • @NahuelFouilleul We need +z-1 (+~-z), not +z+1 (-~z). Nov 27, 2023 at 12:55 • @NahuelFouilleul As a reminder, -n is ~n + 1 by definition of two's complement. So -~n is n + 1, ~n is -(n + 1) = -n - 1 and ~-n is n - 1. Nov 28, 2023 at 12:05 • @Arnauld, thank you, understood, i thought at first glance that the two symbol could be inverted and some tests were passing but testing with values it was obvious. Nov 28, 2023 at 12:08 # Python 3.8 (pre-release), 25 23 bytes lambda l,h,c:-(-l*h//c)  Try it online! Edit • -2 bytes thanks to Neil • I don't think you need the inner set of ()s. – Neil Nov 27, 2023 at 12:21 • -(...) can be 0-... Nov 29, 2023 at 0:31 # Japt, 5 bytes ×/V c  Try it here # sclin, 6 bytes / * |^  Try it on scline! Takes input as H L C. # Vyxalr, 3 bytes */⌈  Try it Online! Hehehehe flag go brrrr # PowerShell, 40 bytes param($l,$h,$c)[math]::Ceiling($l*$h/$c)  Try it online! Thanks Julian! # PowerShell, 47 bytes $c={param($l,$h,$c)[math]::Ceiling(($l*$h)/$c)}


Try it online!

Thought I'd throw my own suggestion in :-)

• You can remove the function declaration from the body and remove the parentheses from the multiplication: Try it online! Nov 28, 2023 at 3:49

=roundup(A1*B1/C1)


Put the input in cells A1:C1.

In Microsoft Excel, roundup() requires a second parameter (19 bytes):

=roundup(A1*B1/C1,)

• roundup(X) can also be spelled ceiling(X) or -floor(-X) (which are all exactly the same length) Nov 28, 2023 at 15:56

# ARBLE, 11 bytes

ceil(l*h/c)


Not the most imaginative answer. Arguments as coverage, height, length

Try it online!

# 05AB1E, 3 bytes

/*î


Inputs in the order $$\coverage,length,height\$$.

Explanation:

/    # Divide the second (implicit) input length by the first (implicit) input coverage
*   # Multiply it to the third (implicit) input height
î  # Ceil it
# (after which the result is output implicitly)


# MathGolf, 3 bytes

*╠ü


Inputs (as floats) in the same order as the challenge description: $$\length,height,coverage\$$.

Try it online.

Explanation:

*    # Multiply the first two (implicit) inputs: height*length
╠   # Divide it by the third (implicit) input: (height*length)/coverage
ü  # Ceil it
# (after which the entire stack is output implicitly as result)


# C (gcc), 27 24 bytes

f(l,h,c){l=(l*h+c-1)/c;}


Try it online!

Saved 3 bytes thanks to Sisyphus!!!

• integer divison with (l*h+c-1)/c works i think Nov 29, 2023 at 0:34
• @Sisyphus Nice one - thanks! :D Nov 29, 2023 at 11:44

# Pyth, 34 bytes

K.Q)=+Z*@K0@K1;J0;W>Z0=-Z@K2=+J1;J


Try it online!

I just wanted to try out in Pyth. Unfortunately, Pyth doesn't support float division so, had to use while to do the trick.

#### Explanation

K.Q) - get input in a newline, as in the question's order and store it as list in K

<Z - used to store the product of length and height i.e area

W>Z0=-Z@K2=+J1 - used to iterate until the area isn't 0 and decrement the area by coverage (@K2); and increment J by 1