New answers tagged

0 votes

How Many Paint Tins Do I Need?

MathGolf, 3 bytes *́ Inputs (as floats) in the same order as the challenge description: \$length,height,coverage\$. Try it online. Explanation: ...
Kevin Cruijssen's user avatar
0 votes

How Many Paint Tins Do I Need?

05AB1E, 3 bytes /*î Inputs in the order \$coverage,length,height\$. Try it online or verify all test cases. Explanation: ...
Kevin Cruijssen's user avatar
-1 votes

Convert real numbers between factoradic and positive integer bases

I got the same problems as you
concertwonderland's user avatar
0 votes

How Many Paint Tins Do I Need?

ARBLE, 11 bytes ceil(l*h/c) Not the most imaginative answer. Arguments as coverage, height, length Try it online!
ATaco's user avatar
  • 10.5k
1 vote

How Many Paint Tins Do I Need?

Google Sheets, 18 bytes =roundup(A1*B1/C1) Put the input in cells A1:C1. In Microsoft Excel, ...
doubleunary's user avatar
2 votes

How Many Paint Tins Do I Need?

sclin, 6 bytes / * |^ Try it on scline! Takes input as H L C.
Mama Fun Roll's user avatar
4 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.
Nick Kennedy's user avatar
  • 18.9k
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. ...
Tbw's user avatar
  • 211
5 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 ...
Jonathan Allan's user avatar
1 vote

Convert real numbers between factoradic and positive integer bases

Jelly, 94 93 bytes ⁹1!ḍ@¥1#ḢR;!:¥ɗU×1¦%Ḣd¥\FḊU :1!>¥1#Ḣ’!€Ɗ;ƲUṪd¥\FḊ,ç ḅç/ ẈḶ!U×¥:@ƭ€FṀ$©$ḋ⁸S;®:g/$b A⁵ŀ⁹×1¦ṠFḢɗ Try it online! Test suite A full program taking ...
Nick Kennedy's user avatar
  • 18.9k
0 votes

German pharmacy payment

*><>, 90 89 bytes -1 byte by removing a semicolon that shouldn't have been there I'm still trying to condense it using the dive u and rise ...
Geoffrey H.'s user avatar
2 votes

How Many Paint Tins Do I Need?

Japt, 5 bytes ×/V c Try it here
Shaggy's user avatar
  • 41.6k
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 ...
Neil's user avatar
  • 165k
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. ...
Neil's user avatar
  • 165k
3 votes

How Many Paint Tins Do I Need?

Scala 3, 20 bytes (l,h,c)=>(l*h+c-1)/c Attempt This Online!
138 Aspen's user avatar
  • 4,755
2 votes

How Many Paint Tins Do I Need?

C (gcc), 27 bytes f(l,h,c){l=ceil(1.*l*h/c);} Try it online!
Noodle9's user avatar
  • 19.9k
0 votes

Sum of all integers from 1 to n

Scratch, 31 bytes Try it here define(n say(((n)*((n)+(1)))/(2
UndoneStudios's user avatar
3 votes

How Many Paint Tins Do I Need?

Arturo, 15 bytes $=>[ceil//&*&&] Try it! ...
chunes's user avatar
  • 22.7k
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
SevC_10's user avatar
  • 367
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 ...
I.T Delinquent's user avatar
2 votes

How Many Paint Tins Do I Need?

Vyxal r, 3 bytes */⌈ Try it Online! Hehehehe flag go brrrr
lyxal's user avatar
  • 32.6k
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
Graham's user avatar
  • 5,436
5 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 ...
chunes's user avatar
  • 22.7k
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 ...
l4m2's user avatar
  • 20.3k
1 vote

Sum of all integers from 1 to n

bc, 9 bytes n*(n+1)/2 Try it online! Weird how some shell solutions call bc instead of just writing ...
roblogic's user avatar
  • 2,734
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:...
Tbw's user avatar
  • 211
0 votes

German pharmacy payment

Rust, 50 bytes |x|(500f64.max(1e1*x).min(1e3).round()/1e2).min(x) Try it online!
cg909's user avatar
  • 321
-1 votes

German pharmacy payment

Desmos, 30 actually 35 bytes A one-liner Desmos equation for once (thanks to Aiden Chow for the fix and optimization): f(x)=round([x,5,10,x/10].sort[2],2) Try it ...
Infigon's user avatar
  • 561
1 vote

German pharmacy payment

Python, 41 bytes lambda x:min(max(5,(x*20+1)//2/100),x,10) Attempt This Online! Straight-forward implementation of OP's formula. For the rounding it uses floor ...
Albert.Lang's user avatar
  • 2,229
0 votes

German pharmacy payment

Scala 3, 106 100 bytes Saved 6 bytes thanks to @corvus_192 Golfed version. Attempt This Online! ...
138 Aspen's user avatar
  • 4,755
0 votes

German pharmacy payment

AWK, 48 bytes {y=$0/10;a=y>5?y>10?10:y:5>$0?$0:5;print a+1e-4} Try it online! Ungolfed : ...
Marius_Couet's user avatar
0 votes

German pharmacy payment

05AB1E, 16 (or 25) bytes T/5‚à‚Tªß4°z+2.ò Try it online or verify all test cases. This outputs 5.0 or ...
Kevin Cruijssen's user avatar
0 votes

German pharmacy payment

PARI/GP, 44 bytes x->printf("%.2f",min(x,min(max(x/10,5),10))) Attempt This Online! A port of @Evargalo's R answer. Prints the result to stdout.
alephalpha's user avatar
  • 46.5k
0 votes

German pharmacy payment

Wolfram Language (Mathematica), 36 bytes #~Min~Max[.1#,5]~Min~10~Round~.01&@x Alas, we cannot save an extra byte by using infix notation with ...
dalamajama's user avatar
0 votes

German pharmacy payment

sclin, 26 bytes dup.1*5|10,` &/100* |~100/ Try it on scline! sclin's default real/rational number representation comes in handy here. Explanation Prettified ...
Mama Fun Roll's user avatar
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 ...
Evargalo's user avatar
  • 241
0 votes

German pharmacy payment

Uiua 0.3.1, 16 bytes ↧↧↥5⍜×⁅100⊃÷∘10. See it in action
RomanPro100's user avatar
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: ...
G B's user avatar
  • 21.3k
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 ...
doubleunary's user avatar
0 votes

German pharmacy payment

Charcoal, 21 bytes NθI⌊⟦θχ⌈⟦⁵∕⌊⁺·⁵×θχ¹⁰⁰ Try it online! Link is to verbose version of code. Explanation: Port of the formula given in the question, but with ...
Neil's user avatar
  • 165k
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. ...
Neil's user avatar
  • 165k
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? ...
Jonathan Allan's user avatar
1 vote

German pharmacy payment

JavaScript (ES6), 45 bytes x=>~~(Math.min(x*10,x<50?50:x,100)*10+.5)/100 Try it online! 40 bytes This one works in theory, but fails on some test cases ...
Arnauld's user avatar
  • 188k
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
Graham's user avatar
  • 5,436
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 ...
l4m2's user avatar
  • 20.3k
1 vote

Print 0 to 100 without 1-9 characters

Hexagony, 19 bytes &!)')$0<.0.>.;/-{@_ Try it online! or on hexagony.net In hexagon layout: ...
Sergei Kozelko's user avatar
0 votes

Print 0 to 100 without 1-9 characters

vemf, 5 bytes 0,│d↨ cancats 0 and the integers on [1, 100]
merrybot's user avatar
  • 181
1 vote

Golf me the Schlosberg Numbers

Scala 3, 52 bytes Stream.from(0).filter(n=>math.sqrt(n).toInt%2==0)(_) Attempt This Online!
138 Aspen's user avatar
  • 4,755
0 votes

Print 0 to 100 without 1-9 characters

Commodore 64 = 27 Bytes 0FORO=.TO{PI}+{PI}*{PI}*{PI}*{PI}:PRINTO;:NEXT
TGS's user avatar
  • 51
1 vote

Print 0 to 100 without 1-9 characters

Vyxal SH, 7 bitsv2, 0.875 bytes ʀ Try it Online! Another flag cocktail. Bitstring 0001101
The Empty String Photographer's user avatar

Top 50 recent answers are included