« first day (2569 days earlier)      last day (2274 days later) » 
00:00 - 22:0022:00 - 00:00

10:05 PM
-5
Q: Selling electricity

McLinuxJack is a little businessman. He found out a way to earn money by buying electricity on days when it's cheap and selling it when it's much more expensive. He stores the electricity in a battery he made by himself. You are given N, the number of days Jack knows the cost of electricity for, and X, ...

 
10:45 PM
Holy downvotes
Anybody know what this static results from?
 
@DJMcMayhem you can also "overlook" and "overlook"
 
Anonymous
@Zacharý I'd guess a bad VGA connection/cable
 
Regex Q: If I have a repeated string and want to capture each of the repetitions, how would I go about that? E.g. "abc def ghi" => ["abc", "def", "ghi"]? (<match>)* doesn't seem to work :/
 
@cairdcoinheringaahing What flavor?
 
10:52 PM
That's not really a regex question. What programming language are you using?
 
Anonymous
s.split()?
 
No, the strings themselves are more complicated than that (hence regex)
 
So re.findall("\a+", s), or even better what Mego said
 
10:54 PM
Well, split works only for whitespace or a fixed string.
@DJMcMayhem What's \a?
 
In vim it's [a-zA-Z], but I don't really know other flavors, so maybe that isn't standard
 
Python doesn't have it. tio.run/##K6gsycjPM/7/…
 
Vim is the only regex I'm familiar with, and it has some quirks (for example, '+()?' all need to be escaped)
 
@Dennis It's the regular string escape for the bell character
I think Dj meant \\A
 
@Pavel That throws a ton of errors for some reason o_O
 
10:56 PM
@Pavel Fair point. r'\a' doesn't work either though.
 
Which is start of line
@Dennis Right. Capital A.
 
I think python regex just doesn't have that
 
No, that doesn't work either.
Python's re doesn't use PCRE.
 
Anonymous
\A is start of string
 
Anonymous
Python doesn't have a shorthand for [a-zA-Z]
 
10:57 PM
Oh, I didn't know that's what you were trying to do
 
@Dennis sigh. I just shouldn't ever be asked regex questions that aren't in vim
 
-1
Q: John's lost arrays

McLinuxJohn has made an array or a few containing numbers which are important to him. Unfortunately, John lost the arrays. Luckily, he knows some details about the arrays. You are given T, the number of test cases, and in each test case you are given N, the number of digits in the array, and M, the numb...

 
Anonymous
The fact that \A and \Z are start and end of string (respectively) makes me happy
 
What the heck? What's wrong with ^ and $?
 
.____.
 
10:59 PM
@DJMcMayhem ^$ are start and end of line.
\A and \Z are for multiline strings
 
Anonymous
@Pavel Exactly. \A and \Z aren't affected by the multiline setting
 
@Downgoat Heh, that reminds me about the falsehoods programmers believe about time.
 
How would you abbreviate micrograms if you can't type the weird 'u' symbol thing ('mu')? Using only ASCII
Would that just mcg?
 
Anonymous
@DJMcMayhem I'd probably do mmg, since m is 1/1000
 
So... milli-milli-grams?
 
11:06 PM
mcg is the most common ASCII alternative.
Although, in the interest of clarity, I wouldn't abbreviate it at all.
 
Anonymous
@DJMcMayhem Sure, it's only slightly heinous
 
Anonymous
CMC: given a blasphemous abbreviation of a unit (like mmg for µg or kmm for m), normalize it
 
@Mego How are you getting kmm=m?
Oh wait...
Kilo-milli-meters?
 
Anonymous
Yes
 
@Mego My response is a kilo-ಠ_ಠ
 
Anonymous
11:09 PM
i.e. multiply the scaling factors of the prefixes, and then use the appropriate prefix
 
Anonymous
@DJMcMayhem I did say blasphemous
 
Please add mmHg as a test case.
 
Anonymous
@Dennis I think you mean µmkHg :P
 
@Mego µmkHgm/m
 
Um, the second m is meter.
 
Anonymous
11:14 PM
mJHg/kg/s/s
 
I see Hg and can't parse it as anything but Mercury
 
Anonymous
@Pavel It's supposed to be mercury
 
Yes, mmHg is millimeters of mercury.
 
Ah, I thought there was an H prefix being applied to meters.
 
A rather archaic unit that is still widely used to measure blood pressure.
 
Anonymous
11:15 PM
mmHg is a standard unit of pressure, used in medicine
 
@Mego Bonus points: Convert crap units to sane units, e.g. kyd -> .9144km
 
kyd?
 
Kilo-yard I assume
 
Yep
 
@Mego I forgot to give context, it was when I was running the Allegro5 library with a D wrapper.
 
11:20 PM
W|A parses it, therefore it's a real unit: wolframalpha.com/input/?i=7+kyd+to+m
 
I always forget: how many pinky toes are there in a yard?
 
I can't even remember how many feet there are. I just have a vague understanding of how much a yard or a foor or an inch is, and can't do unit conversions at all.
 
3 ft = 1 yd
 
1U → 0.1778 m
 
@Dennis ... 3?
 
Anonymous
11:21 PM
@Dennis More than 1
 
@DJMcMayhem That's why USA is weird
 
Also, 5280 feet in a mile. Dafuq.
 
@Zacharý s/USA/imperial system
 
@Pavel I only remember that do to my friend's quiz he made a while ago.
 
@DJMcMayhem Over 99% of people who use the imperial system are 'murican.
 
11:22 PM
@DJMcMayhem It's technically a modified imperial system.
 
Theoatmeal has a nice article on imperial units, but it's probably a bad idea to link it here.
 
@Dennis Is it?
 
nLD → 0.380 m
 
@Adám What's a U or a nLD?
 
@Adám WTF are you listing?
 
11:23 PM
@Pavel Generally NSFW.
 
@Zacharý Oh? How so?
 
@Zacharý Unusual units which have an abbreviation.
 
@Dennis Surely the one on units isn't.
 
U is for rack Unit, LD is Lunar Distance.
 
11:25 PM
@DJMcMayhem By fitting them exactly to metric (albeit with conversion factors aplenty), IIRC
 
@Dennis Ok, "Five medium-sized gerbil penises" is a little NSFW.
 
@Dennis It's not NSFW per se, but it does include Gerbil Genitals in the first panel :P
 
ninja'd
 
1 mDDB → 0.1125 m³
 
FWIW, I fully agree that imperial is dumb, and I would rather use metric. But since I don't use metric, and I've learned to think in imperial, there's no way I would switch.
 
11:28 PM
I'm fine with both, except I never did figure out Fahrenheit.
I grew up in a metric-system-using household.
 
"Radians Fahrenheit or radians Celsius?" "Uh, sorry, gotta go!"
3
 
@DJMcMayhem That's the entire reason imperial/US units even exist any more
 
@Zacharý Well, that and the staggeringly enormous cost it would take to change all existing infrastructure over to metric
Can you imagine how much it would cost to change every single road sign, not to mention the million other things that would have to change?
 
@Pavel It is.
 
11:31 PM
> Assuming new Routemaster double decker buses for "DDB" | Use old Routemaster double decker buses instead
Well shit
 
@DJMcMayhem I think there's a town in US that uses metric, due to this fact (as it was created right after an act allowed metric, or something)
 
@Pavel I guess my value applies to a different model.
 
11:44 PM
Still, why would we need abbreviations for this stuff?
 
11:58 PM
Like, really? Double decker buses?
 
00:00 - 22:0022:00 - 00:00

« first day (2569 days earlier)      last day (2274 days later) »