Skip to main content
Commonmark migration
Source Link

#CJam, 31 30 29 bytes

CJam, 31 30 29 bytes

24,[U3]m*"'%02d:%d0',
"fe%~7<

This is pretty straight forward using printf formatting:

24,                              e# get the array 0..23
   [U3]                          e# put array [0 3] on stack
       m*                        e# do a cartesian product between 0..23 and [0 3] array
                                 e# now we have tuples like [[0 0], [0 3] ... ] etc
         "'%02d:%d0',
"fe%                             e# this is standard printf formatting. What we do here is
                                 e# is that we format each tuple on this string
    ~7<                          e# unwrap and remove comma and new line from last line
                                 e# by taking only first 7 characters

Try it online here

#CJam, 31 30 29 bytes

24,[U3]m*"'%02d:%d0',
"fe%~7<

This is pretty straight forward using printf formatting:

24,                              e# get the array 0..23
   [U3]                          e# put array [0 3] on stack
       m*                        e# do a cartesian product between 0..23 and [0 3] array
                                 e# now we have tuples like [[0 0], [0 3] ... ] etc
         "'%02d:%d0',
"fe%                             e# this is standard printf formatting. What we do here is
                                 e# is that we format each tuple on this string
    ~7<                          e# unwrap and remove comma and new line from last line
                                 e# by taking only first 7 characters

Try it online here

CJam, 31 30 29 bytes

24,[U3]m*"'%02d:%d0',
"fe%~7<

This is pretty straight forward using printf formatting:

24,                              e# get the array 0..23
   [U3]                          e# put array [0 3] on stack
       m*                        e# do a cartesian product between 0..23 and [0 3] array
                                 e# now we have tuples like [[0 0], [0 3] ... ] etc
         "'%02d:%d0',
"fe%                             e# this is standard printf formatting. What we do here is
                                 e# is that we format each tuple on this string
    ~7<                          e# unwrap and remove comma and new line from last line
                                 e# by taking only first 7 characters

Try it online here

deleted 64 characters in body
Source Link
Optimizer
  • 26.6k
  • 7
  • 66
  • 142

#CJam, 31 30 3029 bytes

24,[U3]m*{"'%02d[U3]m*"'%02d:%d0',
"e%}/7<"fe%~7<

This is pretty straight forward using printf formatting:

24,                              e# get the array 0..23
   [U3]                          e# put array [0 3] on stack
       m*                        e# do a cartesian product between 0..23 and [0 3] array
                                 e# now we have tuples like [[0 0], [0 3] ... ] etc
         {                }/     e# iterate over all such tuples
          "'%02d:%d0',
"e% "fe%                             e# this is standard printf formatting. What we do here is
                                 e# is tothat usewe theformat tupleseach andtuple formaton thethis string
     7<~7<                          e# unwrap and remove comma and new line from last line by taking
                                 e# by taking only first 7 characters

Try it online hereTry it online here

#CJam, 31 30 bytes

24,[U3]m*{"'%02d:%d0',
"e%}/7<

This is pretty straight forward using printf formatting:

24,                              e# get the array 0..23
   [U3]                          e# put array [0 3] on stack
       m*                        e# do a cartesian product between 0..23 and [0 3] array
                                 e# now we have tuples like [[0 0], [0 3] ... ] etc
         {                }/     e# iterate over all such tuples
          "'%02d:%d0',
"e%                              e# this is standard printf formatting. What we do here is
                                 e# is to use the tuples and format the string
     7<                          e# remove comma and new line from last line by taking
                                 e# only first 7 characters

Try it online here

#CJam, 31 30 29 bytes

24,[U3]m*"'%02d:%d0',
"fe%~7<

This is pretty straight forward using printf formatting:

24,                              e# get the array 0..23
   [U3]                          e# put array [0 3] on stack
       m*                        e# do a cartesian product between 0..23 and [0 3] array
                                 e# now we have tuples like [[0 0], [0 3] ... ] etc
         "'%02d:%d0',
"fe%                             e# this is standard printf formatting. What we do here is
                                 e# is that we format each tuple on this string
    ~7<                          e# unwrap and remove comma and new line from last line
                                 e# by taking only first 7 characters

Try it online here

added 34 characters in body
Source Link
Optimizer
  • 26.6k
  • 7
  • 66
  • 142

#CJam, 3131 30 bytes

24,"03"m*[U3]m*{'"'%02d:*''\s4Ue[0'''%d0',N
"e%}/;;7<

This is pretty straight forward using printf formatting:

24,                              e# get the array 0..23
   "03"[U3]                          e# put thisarray string[0 3] on stack
       m*                        e# do a cartesian product between 0..23 and ['0,'3][0 3] array
                                 e# now we have tuples like [[0 '0]0], [0 '3]3] ... ] etc
         {                }/     e# iterate over all such tuples
          ':*                    e# join the pair with : tuples become like [0 '"'%02d: '0]%d0',
"e%             ''\                 e# insert a quote before it
                s4Ue[            e# convert thethis tupleis tostandard stringprintf andformatting. makeWhat surewe itdo hashere ais
                                 e# padded zero before 0is to 9 hrs
                     ''',     use the tuples e#and putformat twothe characters,string
 quote and comma
  7<                       N   e# remove comma and e#new putline afrom newlast line
  by taking
                          ;;   e# remove comma and newe# lineonly fromfirst last7 linecharacters

Try it online hereTry it online here

#CJam, 31 bytes

24,"03"m*{':*''\s4Ue[0''',N}/;;

This is pretty straight forward:

24,                              e# get the array 0..23
   "03"                          e# put this string on stack
       m*                        e# do a cartesian product between 0..23 and ['0,'3] array
                                 e# now we have tuples like [[0 '0], [0 '3] ... ] etc
         {                }/     e# iterate over all such tuples
          ':*                    e# join the pair with : tuples become like [0 ': '0]
             ''\                 e# insert a quote before it
                s4Ue[            e# convert the tuple to string and make sure it has a
                                 e# padded zero before 0 to 9 hrs
                     ''',        e# put two characters, quote and comma
                         N       e# put a new line
                             ;;   e# remove comma and new line from last line

Try it online here

#CJam, 31 30 bytes

24,[U3]m*{"'%02d:%d0',
"e%}/7<

This is pretty straight forward using printf formatting:

24,                              e# get the array 0..23
   [U3]                          e# put array [0 3] on stack
       m*                        e# do a cartesian product between 0..23 and [0 3] array
                                 e# now we have tuples like [[0 0], [0 3] ... ] etc
         {                }/     e# iterate over all such tuples
          "'%02d:%d0',
"e%                              e# this is standard printf formatting. What we do here is
                                 e# is to use the tuples and format the string
     7<                          e# remove comma and new line from last line by taking
                                 e# only first 7 characters

Try it online here

Source Link
Optimizer
  • 26.6k
  • 7
  • 66
  • 142
Loading