Revision ad45b74c-752e-4542-81d5-82eb738d7979 - Code Golf Stack Exchange

## [QBIC](https://drive.google.com/drive/folders/0B0R1Jgqp8Gg4cVJCZkRkdEthZDQ), <s>82</s> 72 bytes

 :[0,23|[0,59|[0,59|~b+c+d=a|?!b$+@:`+right$(@0`+!c,2ドル)+A+right$(B+!d,2ドル)

This hits an unfortunate spot in QBasic, with casting to number, trimming and prepending a `0` when necessary is really costly.

Sample output:

 Command line: 119
 1:59:59
 2:58:59
 2:59:58
 3:57:59
 [... SNIP 270 lines ...]
 23:58:38
 23:59:37


<s>Explanation</s> I wrote a novel about it:

 : Get N, call it 'a'
 [0,23| Loop through the hours; this FOR loop is initialised with 2 parameters
 using a comma to separate FROM and TO, and a '|' to delimit the argument list
 [0,59| Same for the minutes
 [0,59| And the seconds
 QBIC automatically creates variables to use as loop-counters: 
 b, c, d (a was already taken by ':')
 ~b+c+d=a IF a == b+c+d
 | THEN
 ? PRINT
 ! CAST
 b 'b'
 $ To String; casting num to str in QBasic adds a space, this is trimmed in QBIC
 +@:` Create string A,ドル containing ":"
 +right$ This is a QBasic function, but since it's all lowercase (and '$' is 
 not a function in QBIC) it remains unaltered in the resulting QBasic.
 (@0`+!c,2ドル) Pad the minutes by prepending a 0, then taking the rightmost 2 characters.
 +A Remember that semicolon in A$? Add it again
 +right$ Same for the seconds
 (B+!d,2ドル) Reusing the 0-string saves 2 bytes :-)

AltStyle によって変換されたページ (->オリジナル) /