8
votes
German pharmacy payment
Jelly, 14 bytes
÷⁵«⁵»5«+ȷ-4ær2
A monadic Link that accepts the full price as a float and outputs the charge as a float.
Try it online!
How?
...
6
votes
German pharmacy payment
APL+WIN, 21 bytes
Prompts for input
2⍕(n⌊((.1×n←⎕)⌈5))⌊10
Try it online! Thanks to Dyalog Classic
6
votes
How Many Paint Tins Do I Need?
Uiua, 4 3 bytes
⌈×÷
Try it!
-1 thanks to alephalpha
Takes input in the order coverage length height
...
6
votes
How Many Paint Tins Do I Need?
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 ...
5
votes
German pharmacy payment
R, 39 bytes
\(x)round(.001+min(x,max(.1*x,5),10),2)
Basically using the formula given by the OP.
-5 bytes thanks to @doubleunary
-3 bytes and fix a rounding error ...
5
votes
How Many Paint Tins Do I Need?
Vyxal 3, 3 bytes
÷×⌈
Try it Online!
Similar to most other answers. Divide by coverage, multiply by other dimension, take ceiling.
4
votes
German pharmacy payment
APL (Dyalog Unicode), 13 bytes
2⍕⊢⌊10⌊5⌈.1×⊢
Try it online!
Tacit prefix function. Takes input as number.
Thanks to Graham for original APL solution.
How it works:...
4
votes
How Many Paint Tins Do I Need?
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.
...
3
votes
Print 0 to 100 without 1-9 characters
makina, 58 bytes
v<<<<<<LtIaaa;
>Pu>>>?= LCS
UC>n0;H>>^>>n0;
UPJ >JC>U
I AM BUTTER FEED ME BOT
I'm a bot. ...
3
votes
German pharmacy payment
JavaScript (Node.js), 40 bytes
x=>Math.min(x,x<50?5:(x*10+.5|0)/100,10)
Try it online!
Python 3, 45 bytes
...
3
votes
How Many Paint Tins Do I Need?
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
...
3
votes
How Many Paint Tins Do I Need?
APL+WIN, 6 bytes
Prompts for three numbers. Coverage followed by wall dimensions:
⌈⎕×⎕÷⎕
Try it online! Thanks to Dyalog Classic
3
votes
How Many Paint Tins Do I Need?
Python 3.8 (pre-release), 25 23 bytes
lambda l,h,c:-(-l*h//c)
Try it online!
Edit
-2 bytes thanks to Neil
3
votes
3
votes
3
votes
How Many Paint Tins Do I Need?
Charcoal, 8 bytes
I±÷×NN±N
Try it online! Link is to verbose version of code. Explanation: Port of @SevC_10's Python answer.
...
3
votes
How Many Paint Tins Do I Need?
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 ...
3
votes
3
votes
2
votes
Increment an Array
R, 45 bytes
\(x)`if`(sd(c(x,x)),x+!rank(x,,"f")-1,c(x,1))
Attempt This Online!
This would be 4 bytes longer as a full program, which is a fairer ...
2
votes
2
votes
How long is my number: Restricted Version
TI-Basic, 9 8 bytes
int(log(1+10abs(Ans
Takes input in Ans.
-1 byte thanks to MarcMush.
2
votes
2
votes
German pharmacy payment
Retina 0.8.2, 95 92 bytes
\.
.+
$*
^(.{1000}(?=.{8995})|.(.{499,998})(?=\2{9}....)|.{0,500}).*
00$.1
0*(.+)(..)
$1.$2
Try it online! Link includes test cases. ...
2
votes
No strings (or numbers) attached
Vyxal, 22 bytes
›
⇧
›⇧
⇧⇧
₀½
⇧T
₀⇩‹
₀⇩
₀‹
₀
₄E∑⇧
Try it Online!
I think all of these are optimal aside from maybe 7 and 42, but I couldn't find anything shorter. ...
2
votes
No strings (or numbers) attached
Uiua, 37 36 bytes
⌊⚂
⌊η
⌈η
⌊π
⌈π
⌈+πη
⌊τ
⌈τ
⌈+τη
⌊×ππ
⌈×ππ
⌊+τⁿππ
Try it!
I will be curious to see if anyone has any two-byters for 0. I found a dozen three-byters....
2
votes
German pharmacy payment
Google Sheets / Microsoft Excel, 31 bytes
=fixed(min(10,A1,max(5,A1/10)))
Put the input in cell A1 and the formula in ...
2
votes
German pharmacy payment
Ruby, 42 36 bytes
->a{[a,[a/10,5].max,10].min.round 2}
Try it online!
Ruby, 38 bytes
Formatted as per initial requirement:
...
2
votes
2
votes
How Many Paint Tins Do I Need?
PowerShell, 40 bytes
param($l,$h,$c)[math]::Ceiling($l*$h/$c)
Try it online!
Thanks Julian!
PowerShell, 47 bytes
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
number × 1300code-golf × 1209
math × 295
sequence × 241
arithmetic × 151
integer × 116
string × 104
number-theory × 98
decision-problem × 95
array × 87
primes × 66
base-conversion × 55
code-challenge × 46
binary × 41
ascii-art × 35
kolmogorov-complexity × 32
combinatorics × 28
random × 23
fibonacci × 22
matrix × 21
restricted-source × 19
rational-numbers × 19
sorting × 18
permutations × 18
fastest-code × 17