Created
September 12, 2016 01:09
-
-
Save shelvacu/c6da66d602eb6c9313898a69570cea1f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DtHIqH18R0IqH13R1K0FbjH2=+K-4b)RtKJsmtdr1QJ-QJ | |
DtH Define method t with argument H | |
IqH18 If H is equal to 18 | |
R0 Return 0 (implicitly ends If block) | |
IqH13 If H is equal to 13 | |
R1 Return 1 | |
K0 Set variable K to 0 | |
Fb For every value in 'jH2', set variable b to that value and execute block | |
jH2 Convert H to base 2 as an array of integers | |
=+K Set K to K + '-4b' | |
-4b 4 minus b | |
) End for loop | |
RtK Return t(K). Implicitly ends function definition | |
J Set J equal to: | |
s The sum of all integers in: | |
m Map a set of values (second arg) using a lambda with parameter named d (first argument) | |
td lambda d: t(d) | |
r1Q A range from 1 to Q. Q is automatically set to stdin evaluated | |
J Implicitly print J | |
-QJ Implicitly print the result of subtracting J from Q |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment