Yesterday I found this interesting code-puzzler on java.dzone.com:
How Many 1's Appear in A Binary Clock Across an Entire Day
Say you have a binary clock, where 09:30:22 would be displayed as
Hour: 00001001
Minute: 00011110
Second: 00010110
Calculate the number of 1's that would appear over the course of an entire day of military time starting from 00:00:00 all the way up to 23:59:59
My last entry was:
while(1){$_+=(unpack"%32B*",pack"i3",gmtime++$i)||last}print
I'm sure it's possible to shorten that.
Why not give it a try!
In reply to binary clock from java.dzone.com by Skeeve
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |