Activity for Arpad Horvath
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Edit | Post #291390 | Initial revision | — | 8 months ago |
Answer | — |
A: Round trip stones [Python], 104 bytes ```python f=lambda n:"1.0000000.7272730.7285710.7368420.7437890.7491640.7533440.7566570.7593360.761542"[8n-8:8n] ``` Try it online! Not too clever. I am curious whether it can be beaten with a Python code that really calculates the probability and prints the result... (more) |
— | 8 months ago |
Edit | Post #291320 |
Post edited: version |
— | 8 months ago |
Edit | Post #291320 |
Post edited: just python |
— | 8 months ago |
Edit | Post #291320 |
Post edited: |
— | 8 months ago |
Comment | Post #291320 |
There are 8 kind of characters, " IXLCDM". 2 characters are 6 bits that can be easily mapped to printable characters (after 32 code point). This string is much shorter then the "DD DM IC ..." string itself. Even if I add the extraction it is still somewhat shorter.
I just regenerate the " IXLCDM" ... (more) |
— | 8 months ago |
Edit | Post #291324 | Initial revision | — | 8 months ago |
Answer | — |
A: The 50 substrings that validate any string of Roman numerals [Haskell], 271 bytes import Data.Char import Data.List n=" IVXLCDM" r x=maximum[if(s`isInfixOf`x)then s else"A"|s(n!!div x 8):[(n!!(x-8(div x 8)))])$map(\x->ord x-32)"&PW!H.!@/$HF$@G\"H6\"@7\"03#P?%N%O%U%]%^%&N&O!!+!1!=!9!<!:!;$=$<\"\"+#M#N#L#O#K#C#=#<%MH))\'X;;"] Try it ... (more) |
— | 8 months ago |
Edit | Post #291320 |
Post edited: even shorter 220 |
— | 8 months ago |
Comment | Post #291320 |
Sorry for making that much work for you. My bad. I don't know exactly what did I do then but does't work for me now. But fortunately the current one is just 1 bytes longer.
It works if I use square brackets inside te max function, but then it is longer then the current one. (more) |
— | 8 months ago |
Edit | Post #291320 |
Post edited: Fixing the code |
— | 8 months ago |
Edit | Post #291320 |
Post edited: 3.9 |
— | 8 months ago |
Edit | Post #291320 |
Post edited: |
— | 8 months ago |
Edit | Post #291320 |
Post edited: shorter |
— | 8 months ago |
Edit | Post #291320 |
Post edited: |
— | 8 months ago |
Edit | Post #291320 | Initial revision | — | 8 months ago |
Answer | — |
A: The 50 substrings that validate any string of Roman numerals [Python], 220 bytes Works with Python 3.8 or newer. n=" IVXLCDM" x=("".join([n[(d:=ord(c)-32)//8]+n[d-8(d//8)]for c in'&PW!H.!@/$HF$@G"H6"@7"03#P?%N%O%U%]%^%&N&O!!+!1!=!9! r=lambda c:max(s if s in c else"A"for s in'DD DM IC ID IL IM LC LD LL LM VC VD VL VM VV VX XD XM CCD CC... (more) |
— | 8 months ago |
Edit | Post #291299 |
Post edited: small fix |
— | 8 months ago |
Edit | Post #291299 |
Post edited: remove test |
— | 8 months ago |
Edit | Post #291299 |
Post edited: remove duplicate |
— | 8 months ago |
Edit | Post #291299 |
Post edited: was a long variable name |
— | 8 months ago |
Edit | Post #291299 |
Post edited: try it online after the code |
— | 8 months ago |
Edit | Post #291299 |
Post edited: you can try it online |
— | 8 months ago |
Edit | Post #291299 |
Post edited: Doesn't matter whether the assignments are in one line or several lines, the number of bytes are the same, so I have here the more readable version with new lines. |
— | 8 months ago |
Edit | Post #291299 |
Post edited: 584 |
— | 8 months ago |
Edit | Post #291299 |
Post edited: shorter version |
— | 8 months ago |
Comment | Post #291299 |
Thank you, At the end I have realized, that using 0,1 and 2 instead of the variables is even shorter. (more) |
— | 8 months ago |
Edit | Post #291299 |
Post edited: remove set |
— | 8 months ago |
Edit | Post #291299 |
Post edited: |
— | 8 months ago |
Edit | Post #291299 |
Post edited: reordering long version |
— | 8 months ago |
Edit | Post #291299 |
Post edited: test cases |
— | 8 months ago |
Edit | Post #291299 | Initial revision | — | 8 months ago |
Answer | — |
A: Construct the Irish possessive Python 3.8+, 577 bytes (was 634 than 591 bytes before) V="eéiíaáoóuúEÉIÍAÁOÓUÚ" r={"mé":("mo",0),"tú":("do",0),"sí":("a",1),"sé":("a",0),"muid":("ár",2),"sibh":("bhur",2),"siad":("a",2)} s=lambda a,b:a.upper()if b[0].isupper()else a def f(x,y):w,R=r[x];w=s(w[0]+"'"if w in{"... (more) |
— | 8 months ago |
Edit | Post #290206 |
Post edited: Shorter |
— | about 1 year ago |
Comment | Post #290200 |
Ok. I have added the bytes of the import to the code. (more) |
— | about 1 year ago |
Edit | Post #290206 |
Post edited: +import |
— | about 1 year ago |
Edit | Post #290200 |
Post edited: Adding import |
— | about 1 year ago |
Edit | Post #290206 |
Post edited: Back to 16, ay z_1 is the original |
— | about 1 year ago |
Comment | Post #290206 |
Can I get the iterate function [from a 3rd party package](https://toolz.readthedocs.io/en/latest/api.html#toolz.itertoolz.iterate)? Then I can get a similar solution in Python.
Where can I find a detailed description of the rules? How to count imports, for example. (more) |
— | about 1 year ago |
Edit | Post #290206 |
History hidden: Detailed history before this event is hidden because of a redaction. |
— | about 1 year ago |
Edit | Post #290206 |
Post edited: Some hints how does it work |
— | about 1 year ago |
Edit | Post #290206 |
Post edited: print version |
— | about 1 year ago |
Edit | Post #290206 | Initial revision | — | about 1 year ago |
Answer | — |
A: Is it part of the mandelbrot set? Haskell, 66 bytes -7 bytes thanks to Razetime ``` import Data.Complex (\c->(zz+c)c)!!16) ``` I use the fact, that if the result is bigger than 2, it will be forever then, so I don't need to check this relation in each iterations. It is enough to check it in the end. `iterate(\z->zz+c... (more) |
— | about 1 year ago |
Comment | Post #290106 |
Why should you be sorry? Somebody reads my code in a language not known for him, trying to understand it. And even you found out how to test it. (more) |
— | about 1 year ago |
Comment | Post #290200 |
We don't count import in the result, do we? (more) |
— | about 1 year ago |
Edit | Post #290200 |
Post edited: |
— | about 1 year ago |
Edit | Post #290200 |
Post edited: standard format |
— | about 1 year ago |
Edit | Post #290200 | Initial revision | — | about 1 year ago |
Answer | — |
A: How many umbrellas to cover the beach? Python 3.8+, 219 bytes Short version: ```python from itertools import combinations as c def m(w): for k in range(n:=len(w)): for y in c(range(n),k+1): s=[0]n for x in y: for r in range(w[x]): s[max(0,x-r)]=s[min(n-1,x+r)]=1 if all(s):return k+1 ``` Longer versi... (more) |
— | about 1 year ago |