Get delta of days by current hour and added delta of daysAdvance Happy New Year, 2016!Difference of the square of the sumChange the TimezoneHow many times will a bell tower ring?Sums of 24-hour timeSort a difference listFind the smallest triangle encompassing the specified polygonCount the lucky tickets within the given rangeAll ASCII characters with a given bit countAnalog is Obtuse!

Decreasing star size

Is this photo showing a woman posing in the nude before teenagers real?

Character is called by their first initial. How do I write it?

Why are all my history books dividing Chinese history after the Han dynasty?

Why can't my huge trees be chopped down?

Inadvertently nuked my disk permission structure - why?

Expansion with *.txt in the shell doesn't work if no .txt file exists

The Sword in the Stone

Is it legal for private citizens to "impound" e-scooters?

What does コテッと mean?

Why did so many MPs not vote in Meaningful Vote 3?

High income, sudden windfall

How can I prevent corporations from growing their own workforce?

What is AM-CM inequality?

How do I stop my characters falling in love?

Integral of the integral using NIntegrate

Giant space birds hatching out of planets; short story

At what rate does the volume (velocity) of a note decay?

Why is drive/partition number still used?

What's the difference between 2a and 10a charging options?

Trying to build a function to compute divided difference for arbitrary list of points

Print sums of all subsets

How acidic does a mixture have to be for milk to curdle?

Is a fighting a fallen friend with the help of a redeemed villain story too much for one book



Get delta of days by current hour and added delta of days


Advance Happy New Year, 2016!Difference of the square of the sumChange the TimezoneHow many times will a bell tower ring?Sums of 24-hour timeSort a difference listFind the smallest triangle encompassing the specified polygonCount the lucky tickets within the given rangeAll ASCII characters with a given bit countAnalog is Obtuse!






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1












$begingroup$


Inputs:




  • current hour: from 0 to 23 (inclusive)


  • delta of hours: [current hour] + [delta of hours] = withing the range of Integer

Output:




  • delta of days: the value which shows difference in days between day of current hour and day of sum [current hour] + [delta of hours]

Scoring



  • Answers will be scored in bytes with fewer bytes being better.

Examples:




  • [current hour] = 23; [delta of hours] = -23; delta of days = 0


  • [current hour] = 23; [delta of hours] = 1; delta of days = 1


  • [current hour] = 23; [delta of hours] = 24; delta of days = 1


  • [current hour] = 23; [delta of hours] = 25; delta of days = 2


  • [current hour] = 23; [delta of hours] = -24; delta of days = -1


  • [current hour] = 23; [delta of hours] = -47; delta of days = -1









share|improve this question









New contributor



Ivan Gerasimenko is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$











  • $begingroup$
    Welcome to CGCC! The code-challenge tag is reserved for custom winning criteria. Did you mean code-golf?
    $endgroup$
    – Arnauld
    yesterday










  • $begingroup$
    @Arnauld , yeah, is it enough to specify tag?
    $endgroup$
    – Ivan Gerasimenko
    yesterday










  • $begingroup$
    Yes, that's fine.
    $endgroup$
    – Arnauld
    yesterday










  • $begingroup$
    Welcome to the site! I am going to have to disagree with Arnauld and suggest that a description of the winning criterion is present in the body of the challenge. Here is a good summary of why I think this which seems to have the approval of our community. I've gone ahead and edited a winning criterion into your challenge based on my best guess feel free to change it.
    $endgroup$
    – Sriotchilism O'Zaic
    yesterday











  • $begingroup$
    @SriotchilismO'Zaic , nice! Thank you
    $endgroup$
    – Ivan Gerasimenko
    yesterday

















1












$begingroup$


Inputs:




  • current hour: from 0 to 23 (inclusive)


  • delta of hours: [current hour] + [delta of hours] = withing the range of Integer

Output:




  • delta of days: the value which shows difference in days between day of current hour and day of sum [current hour] + [delta of hours]

Scoring



  • Answers will be scored in bytes with fewer bytes being better.

Examples:




  • [current hour] = 23; [delta of hours] = -23; delta of days = 0


  • [current hour] = 23; [delta of hours] = 1; delta of days = 1


  • [current hour] = 23; [delta of hours] = 24; delta of days = 1


  • [current hour] = 23; [delta of hours] = 25; delta of days = 2


  • [current hour] = 23; [delta of hours] = -24; delta of days = -1


  • [current hour] = 23; [delta of hours] = -47; delta of days = -1









share|improve this question









New contributor



Ivan Gerasimenko is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$











  • $begingroup$
    Welcome to CGCC! The code-challenge tag is reserved for custom winning criteria. Did you mean code-golf?
    $endgroup$
    – Arnauld
    yesterday










  • $begingroup$
    @Arnauld , yeah, is it enough to specify tag?
    $endgroup$
    – Ivan Gerasimenko
    yesterday










  • $begingroup$
    Yes, that's fine.
    $endgroup$
    – Arnauld
    yesterday










  • $begingroup$
    Welcome to the site! I am going to have to disagree with Arnauld and suggest that a description of the winning criterion is present in the body of the challenge. Here is a good summary of why I think this which seems to have the approval of our community. I've gone ahead and edited a winning criterion into your challenge based on my best guess feel free to change it.
    $endgroup$
    – Sriotchilism O'Zaic
    yesterday











  • $begingroup$
    @SriotchilismO'Zaic , nice! Thank you
    $endgroup$
    – Ivan Gerasimenko
    yesterday













1












1








1


0



$begingroup$


Inputs:




  • current hour: from 0 to 23 (inclusive)


  • delta of hours: [current hour] + [delta of hours] = withing the range of Integer

Output:




  • delta of days: the value which shows difference in days between day of current hour and day of sum [current hour] + [delta of hours]

Scoring



  • Answers will be scored in bytes with fewer bytes being better.

Examples:




  • [current hour] = 23; [delta of hours] = -23; delta of days = 0


  • [current hour] = 23; [delta of hours] = 1; delta of days = 1


  • [current hour] = 23; [delta of hours] = 24; delta of days = 1


  • [current hour] = 23; [delta of hours] = 25; delta of days = 2


  • [current hour] = 23; [delta of hours] = -24; delta of days = -1


  • [current hour] = 23; [delta of hours] = -47; delta of days = -1









share|improve this question









New contributor



Ivan Gerasimenko is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$




Inputs:




  • current hour: from 0 to 23 (inclusive)


  • delta of hours: [current hour] + [delta of hours] = withing the range of Integer

Output:




  • delta of days: the value which shows difference in days between day of current hour and day of sum [current hour] + [delta of hours]

Scoring



  • Answers will be scored in bytes with fewer bytes being better.

Examples:




  • [current hour] = 23; [delta of hours] = -23; delta of days = 0


  • [current hour] = 23; [delta of hours] = 1; delta of days = 1


  • [current hour] = 23; [delta of hours] = 24; delta of days = 1


  • [current hour] = 23; [delta of hours] = 25; delta of days = 2


  • [current hour] = 23; [delta of hours] = -24; delta of days = -1


  • [current hour] = 23; [delta of hours] = -47; delta of days = -1






code-golf date






share|improve this question









New contributor



Ivan Gerasimenko is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share|improve this question









New contributor



Ivan Gerasimenko is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share|improve this question




share|improve this question








edited yesterday









Sriotchilism O'Zaic

37k10 gold badges168 silver badges379 bronze badges




37k10 gold badges168 silver badges379 bronze badges






New contributor



Ivan Gerasimenko is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








asked yesterday









Ivan GerasimenkoIvan Gerasimenko

1273 bronze badges




1273 bronze badges




New contributor



Ivan Gerasimenko is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




New contributor




Ivan Gerasimenko is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • $begingroup$
    Welcome to CGCC! The code-challenge tag is reserved for custom winning criteria. Did you mean code-golf?
    $endgroup$
    – Arnauld
    yesterday










  • $begingroup$
    @Arnauld , yeah, is it enough to specify tag?
    $endgroup$
    – Ivan Gerasimenko
    yesterday










  • $begingroup$
    Yes, that's fine.
    $endgroup$
    – Arnauld
    yesterday










  • $begingroup$
    Welcome to the site! I am going to have to disagree with Arnauld and suggest that a description of the winning criterion is present in the body of the challenge. Here is a good summary of why I think this which seems to have the approval of our community. I've gone ahead and edited a winning criterion into your challenge based on my best guess feel free to change it.
    $endgroup$
    – Sriotchilism O'Zaic
    yesterday











  • $begingroup$
    @SriotchilismO'Zaic , nice! Thank you
    $endgroup$
    – Ivan Gerasimenko
    yesterday
















  • $begingroup$
    Welcome to CGCC! The code-challenge tag is reserved for custom winning criteria. Did you mean code-golf?
    $endgroup$
    – Arnauld
    yesterday










  • $begingroup$
    @Arnauld , yeah, is it enough to specify tag?
    $endgroup$
    – Ivan Gerasimenko
    yesterday










  • $begingroup$
    Yes, that's fine.
    $endgroup$
    – Arnauld
    yesterday










  • $begingroup$
    Welcome to the site! I am going to have to disagree with Arnauld and suggest that a description of the winning criterion is present in the body of the challenge. Here is a good summary of why I think this which seems to have the approval of our community. I've gone ahead and edited a winning criterion into your challenge based on my best guess feel free to change it.
    $endgroup$
    – Sriotchilism O'Zaic
    yesterday











  • $begingroup$
    @SriotchilismO'Zaic , nice! Thank you
    $endgroup$
    – Ivan Gerasimenko
    yesterday















$begingroup$
Welcome to CGCC! The code-challenge tag is reserved for custom winning criteria. Did you mean code-golf?
$endgroup$
– Arnauld
yesterday




$begingroup$
Welcome to CGCC! The code-challenge tag is reserved for custom winning criteria. Did you mean code-golf?
$endgroup$
– Arnauld
yesterday












$begingroup$
@Arnauld , yeah, is it enough to specify tag?
$endgroup$
– Ivan Gerasimenko
yesterday




$begingroup$
@Arnauld , yeah, is it enough to specify tag?
$endgroup$
– Ivan Gerasimenko
yesterday












$begingroup$
Yes, that's fine.
$endgroup$
– Arnauld
yesterday




$begingroup$
Yes, that's fine.
$endgroup$
– Arnauld
yesterday












$begingroup$
Welcome to the site! I am going to have to disagree with Arnauld and suggest that a description of the winning criterion is present in the body of the challenge. Here is a good summary of why I think this which seems to have the approval of our community. I've gone ahead and edited a winning criterion into your challenge based on my best guess feel free to change it.
$endgroup$
– Sriotchilism O'Zaic
yesterday





$begingroup$
Welcome to the site! I am going to have to disagree with Arnauld and suggest that a description of the winning criterion is present in the body of the challenge. Here is a good summary of why I think this which seems to have the approval of our community. I've gone ahead and edited a winning criterion into your challenge based on my best guess feel free to change it.
$endgroup$
– Sriotchilism O'Zaic
yesterday













$begingroup$
@SriotchilismO'Zaic , nice! Thank you
$endgroup$
– Ivan Gerasimenko
yesterday




$begingroup$
@SriotchilismO'Zaic , nice! Thank you
$endgroup$
– Ivan Gerasimenko
yesterday










13 Answers
13






active

oldest

votes


















5












$begingroup$


Jelly, 4 bytes



+:24


Try it online!



+ add the arguments



:24 integer divide by 24






share|improve this answer









$endgroup$




















    4












    $begingroup$


    APL (Dyalog Unicode), 6 bytesSBCS





    Anonymous tacit infix function, taking current and delta as arguments.



    ⌊24÷⍨+


    Try it online!



    + add the arguments



    24÷⍨ divide that by 24



     floor






    share|improve this answer









    $endgroup$




















      4












      $begingroup$

      JavaScript (ES6),  26  25 bytes



      Takes input as (current)(delta).





      a=>b=>(a+b-(a<-b)*2)/3>>3


      Try it online!



      Commented



      a => // a = current hour
      b => // b = delta of hours
      ( //
      a + b // 1) we compute the sum
      - (a < -b) * 2 // and we subtract 2 if this sum is negative
      // examples:
      // 51 remains 51
      // 23 remains 23
      // -1 is turned into -3
      ) / 3 // 2) float division by 3
      // examples:
      // 51 is turned into 17
      // 23 is turned into 7.666…
      // -3 is turned back into -1
      >> 3 // 3) right arithmetic shift by 3 on the integer part
      // examples:
      // 17 becomes 2
      // 7.666… becomes 0
      // -1 is unchanged



      JavaScript (ES6), 26 bytes



      More straightforward, but less fun and 1 byte longer anyway.



      Takes input as (current)(delta).





      a=>b=>Math.floor((a+b)/24)


      Try it online!






      share|improve this answer











      $endgroup$




















        3












        $begingroup$


        Python 3, 20 19 bytes



        Simple lambda:





        lambda*a:sum(a)//24


        -1 byte thanx to Jonathan Allan



        Try it online!



        Full program for 38 bytes:



        print((int(input())+int(input()))//24)





        share|improve this answer











        $endgroup$








        • 1




          $begingroup$
          Save a byte with *args like so: lambda*a:sum(a)//24. Switch to Python 2 and save another with lambda*a:sum(a)/24.
          $endgroup$
          – Jonathan Allan
          yesterday



















        2












        $begingroup$


        05AB1E (legacy), 4 bytes



        +24÷


        Try it online or verify all test cases.




        05AB1E, 11 5 bytes



        +24/ï


        -6 bytes by porting @Adam's approach in his APL answer.



        Try it online or verify all test cases.



        Explanation:





        + # Sum the two (implicit) input-integers together
        24÷ # Integer-divide this sum by 24
        # (after which the result is output implicitly)

        + # Sum the two (implicit) input-integers together
        24/ # Divide this sum by 24
        ï # Floor
        # (after which the result is output implicitly)


        The legacy version of 05AB1E uses a Python compiler. When integer-dividing, it will always floor the integer, whether the integer it divides is positive or negative.



        The new version of 05AB1E uses an Elixir compiler. When integer-dividing in the new version of 05AB1E, it will round towards 0 (so basically truncates the decimal digits after dividing). So this will floor for positive integers, but ceil for negative integers.






        share|improve this answer











        $endgroup$








        • 1




          $begingroup$
          5 bytes?
          $endgroup$
          – Expired Data
          yesterday










        • $begingroup$
          @ExpiredData Ah, noticed your comment after Adam's answer. But you're indeed right this can be done much easier.. Maybe I should just delete my answer out of shame and let you get the 5-byter. ;)
          $endgroup$
          – Kevin Cruijssen
          yesterday











        • $begingroup$
          nah I'm sure you'll pay me back in bytes saved given how terrible me 05AB1E is at the moment so don't worry!
          $endgroup$
          – Expired Data
          yesterday










        • $begingroup$
          @Adám That's what I initially had in mind when I saw the challenge, but it doesn't work for the [23,-24] and [23,-48] test cases. Which is why I had that weird 11 byter as my initial answer. Integer division will ceil for negative integers, instead of floor.
          $endgroup$
          – Kevin Cruijssen
          yesterday











        • $begingroup$
          Ah, so it rounds towards 0. Fair enough.
          $endgroup$
          – Adám
          yesterday


















        1












        $begingroup$


        Ohm v2, 4 bytes



        +24v


        Try it online!






        share|improve this answer









        $endgroup$




















          1












          $begingroup$


          C# (Visual C# Interactive Compiler), 26 bytes





          a=>b=>Math.Floor((a+b)/24)


          Try it online!






          share|improve this answer









          $endgroup$




















            1












            $begingroup$


            Haskell, 18 bytes





            (flip(div)24.).(+)


            Try it online!




            I've seen people leave off the function declaration in the byte count for pointfree style, so I'm doing the same here.



            Explanation:



            flip(div)24


            First, div is the shorter integer division operator, but it takes in its arguments as x//24 => div x 24, so we need to use flip so that we can partially apply it to 24.



            The double composition is a little weird to explain, so I'll follow the template of this great SO answer:



            f a b = (flip(div)24) (a + b) -- what we want
            f a b = (flip(div)24) ((+) a b) -- un-infixing (+)
            f a b = ((flip(div)24) . ((+) a)) b -- definition of function composition (partially applying (+) onto a)
            f a = (flip(div)24) . ((+) a) -- pointfree reduction
            f a = ((flip(div)24) .) ((+) a) -- associative property
            f a = (((flip(div)24) .) . (+)) a -- definition of function composition
            f = (flip(div)24.) . (+) -- pointfree reduction





            share|improve this answer











            $endgroup$












            • $begingroup$
              You can use backquotes instead of flip: ((`div`24).).(+).
              $endgroup$
              – nimi
              18 hours ago


















            1












            $begingroup$


            R, 28 16 bytes



            Just a port of most of the other answers...

            -12 bytes thanks Giuseppe



            sum(scan())%/%24


            Try it online!






            share|improve this answer











            $endgroup$












            • $begingroup$
              Use x%/%y instead of floor(x/y)
              $endgroup$
              – Giuseppe
              yesterday






            • 1




              $begingroup$
              Or better yet, take input from stdin and do sum(scan())%/%24
              $endgroup$
              – Giuseppe
              yesterday










            • $begingroup$
              Nice one. Will have to remember that trick.
              $endgroup$
              – Robert S.
              yesterday


















            0












            $begingroup$


            Lua, 70 bytes





            s=io.read()
            c,d=s:match("([^,]+),([^,]+)")
            print(math.floor((c+d)/24))


            Try it online!






            share|improve this answer









            $endgroup$




















              0












              $begingroup$


              I, 6 bytes



              Anonymous tacit infix function, taking current and delta as arguments.



              +/24.m


              Try it online!



              Beginning with:



              + the sum of the arguments



              / divide by:



              24 twentyfour



              . apply:



              m floor (minimum)






              share|improve this answer









              $endgroup$




















                0












                $begingroup$


                Retina 0.8.2, 41 bytes



                d+,?
                $*
                (1+)-1
                -
                ^((-)1|124)*.*
                $2$#1


                Try it online! Link includes test suite. Explanation:



                d+,?
                $*


                Convert both inputs to unary and take the sum if the second input is positive.



                (1+)-1
                -


                But if the second input is negative then take the difference.



                ^((-)1|124)*.*
                $2$#1


                Floor divide the input by 24 and convert to decimal. For positive numbers the first alternation never matches so this just counts the number of whole multiples of 24 in the number. For negative numbers the leading -1 counts as an extra negative multiple of 24 in addition to any remaining multiples of 24, thus achieving the desired floor division.






                share|improve this answer









                $endgroup$




















                  0












                  $begingroup$


                  Python 2, 18 bytes



                  lambda*a:sum(a)/24


                  Try it online!






                  share|improve this answer









                  $endgroup$















                    Your Answer






                    StackExchange.ifUsing("editor", function ()
                    StackExchange.using("externalEditor", function ()
                    StackExchange.using("snippets", function ()
                    StackExchange.snippets.init();
                    );
                    );
                    , "code-snippets");

                    StackExchange.ready(function()
                    var channelOptions =
                    tags: "".split(" "),
                    id: "200"
                    ;
                    initTagRenderer("".split(" "), "".split(" "), channelOptions);

                    StackExchange.using("externalEditor", function()
                    // Have to fire editor after snippets, if snippets enabled
                    if (StackExchange.settings.snippets.snippetsEnabled)
                    StackExchange.using("snippets", function()
                    createEditor();
                    );

                    else
                    createEditor();

                    );

                    function createEditor()
                    StackExchange.prepareEditor(
                    heartbeatType: 'answer',
                    autoActivateHeartbeat: false,
                    convertImagesToLinks: false,
                    noModals: true,
                    showLowRepImageUploadWarning: true,
                    reputationToPostImages: null,
                    bindNavPrevention: true,
                    postfix: "",
                    imageUploader:
                    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                    allowUrls: true
                    ,
                    onDemand: true,
                    discardSelector: ".discard-answer"
                    ,immediatelyShowMarkdownHelp:true
                    );



                    );






                    Ivan Gerasimenko is a new contributor. Be nice, and check out our Code of Conduct.









                    draft saved

                    draft discarded


















                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f188809%2fget-delta-of-days-by-current-hour-and-added-delta-of-days%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown

























                    13 Answers
                    13






                    active

                    oldest

                    votes








                    13 Answers
                    13






                    active

                    oldest

                    votes









                    active

                    oldest

                    votes






                    active

                    oldest

                    votes









                    5












                    $begingroup$


                    Jelly, 4 bytes



                    +:24


                    Try it online!



                    + add the arguments



                    :24 integer divide by 24






                    share|improve this answer









                    $endgroup$

















                      5












                      $begingroup$


                      Jelly, 4 bytes



                      +:24


                      Try it online!



                      + add the arguments



                      :24 integer divide by 24






                      share|improve this answer









                      $endgroup$















                        5












                        5








                        5





                        $begingroup$


                        Jelly, 4 bytes



                        +:24


                        Try it online!



                        + add the arguments



                        :24 integer divide by 24






                        share|improve this answer









                        $endgroup$




                        Jelly, 4 bytes



                        +:24


                        Try it online!



                        + add the arguments



                        :24 integer divide by 24







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered yesterday









                        AdámAdám

                        29k2 gold badges79 silver badges212 bronze badges




                        29k2 gold badges79 silver badges212 bronze badges























                            4












                            $begingroup$


                            APL (Dyalog Unicode), 6 bytesSBCS





                            Anonymous tacit infix function, taking current and delta as arguments.



                            ⌊24÷⍨+


                            Try it online!



                            + add the arguments



                            24÷⍨ divide that by 24



                             floor






                            share|improve this answer









                            $endgroup$

















                              4












                              $begingroup$


                              APL (Dyalog Unicode), 6 bytesSBCS





                              Anonymous tacit infix function, taking current and delta as arguments.



                              ⌊24÷⍨+


                              Try it online!



                              + add the arguments



                              24÷⍨ divide that by 24



                               floor






                              share|improve this answer









                              $endgroup$















                                4












                                4








                                4





                                $begingroup$


                                APL (Dyalog Unicode), 6 bytesSBCS





                                Anonymous tacit infix function, taking current and delta as arguments.



                                ⌊24÷⍨+


                                Try it online!



                                + add the arguments



                                24÷⍨ divide that by 24



                                 floor






                                share|improve this answer









                                $endgroup$




                                APL (Dyalog Unicode), 6 bytesSBCS





                                Anonymous tacit infix function, taking current and delta as arguments.



                                ⌊24÷⍨+


                                Try it online!



                                + add the arguments



                                24÷⍨ divide that by 24



                                 floor







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered yesterday









                                AdámAdám

                                29k2 gold badges79 silver badges212 bronze badges




                                29k2 gold badges79 silver badges212 bronze badges





















                                    4












                                    $begingroup$

                                    JavaScript (ES6),  26  25 bytes



                                    Takes input as (current)(delta).





                                    a=>b=>(a+b-(a<-b)*2)/3>>3


                                    Try it online!



                                    Commented



                                    a => // a = current hour
                                    b => // b = delta of hours
                                    ( //
                                    a + b // 1) we compute the sum
                                    - (a < -b) * 2 // and we subtract 2 if this sum is negative
                                    // examples:
                                    // 51 remains 51
                                    // 23 remains 23
                                    // -1 is turned into -3
                                    ) / 3 // 2) float division by 3
                                    // examples:
                                    // 51 is turned into 17
                                    // 23 is turned into 7.666…
                                    // -3 is turned back into -1
                                    >> 3 // 3) right arithmetic shift by 3 on the integer part
                                    // examples:
                                    // 17 becomes 2
                                    // 7.666… becomes 0
                                    // -1 is unchanged



                                    JavaScript (ES6), 26 bytes



                                    More straightforward, but less fun and 1 byte longer anyway.



                                    Takes input as (current)(delta).





                                    a=>b=>Math.floor((a+b)/24)


                                    Try it online!






                                    share|improve this answer











                                    $endgroup$

















                                      4












                                      $begingroup$

                                      JavaScript (ES6),  26  25 bytes



                                      Takes input as (current)(delta).





                                      a=>b=>(a+b-(a<-b)*2)/3>>3


                                      Try it online!



                                      Commented



                                      a => // a = current hour
                                      b => // b = delta of hours
                                      ( //
                                      a + b // 1) we compute the sum
                                      - (a < -b) * 2 // and we subtract 2 if this sum is negative
                                      // examples:
                                      // 51 remains 51
                                      // 23 remains 23
                                      // -1 is turned into -3
                                      ) / 3 // 2) float division by 3
                                      // examples:
                                      // 51 is turned into 17
                                      // 23 is turned into 7.666…
                                      // -3 is turned back into -1
                                      >> 3 // 3) right arithmetic shift by 3 on the integer part
                                      // examples:
                                      // 17 becomes 2
                                      // 7.666… becomes 0
                                      // -1 is unchanged



                                      JavaScript (ES6), 26 bytes



                                      More straightforward, but less fun and 1 byte longer anyway.



                                      Takes input as (current)(delta).





                                      a=>b=>Math.floor((a+b)/24)


                                      Try it online!






                                      share|improve this answer











                                      $endgroup$















                                        4












                                        4








                                        4





                                        $begingroup$

                                        JavaScript (ES6),  26  25 bytes



                                        Takes input as (current)(delta).





                                        a=>b=>(a+b-(a<-b)*2)/3>>3


                                        Try it online!



                                        Commented



                                        a => // a = current hour
                                        b => // b = delta of hours
                                        ( //
                                        a + b // 1) we compute the sum
                                        - (a < -b) * 2 // and we subtract 2 if this sum is negative
                                        // examples:
                                        // 51 remains 51
                                        // 23 remains 23
                                        // -1 is turned into -3
                                        ) / 3 // 2) float division by 3
                                        // examples:
                                        // 51 is turned into 17
                                        // 23 is turned into 7.666…
                                        // -3 is turned back into -1
                                        >> 3 // 3) right arithmetic shift by 3 on the integer part
                                        // examples:
                                        // 17 becomes 2
                                        // 7.666… becomes 0
                                        // -1 is unchanged



                                        JavaScript (ES6), 26 bytes



                                        More straightforward, but less fun and 1 byte longer anyway.



                                        Takes input as (current)(delta).





                                        a=>b=>Math.floor((a+b)/24)


                                        Try it online!






                                        share|improve this answer











                                        $endgroup$



                                        JavaScript (ES6),  26  25 bytes



                                        Takes input as (current)(delta).





                                        a=>b=>(a+b-(a<-b)*2)/3>>3


                                        Try it online!



                                        Commented



                                        a => // a = current hour
                                        b => // b = delta of hours
                                        ( //
                                        a + b // 1) we compute the sum
                                        - (a < -b) * 2 // and we subtract 2 if this sum is negative
                                        // examples:
                                        // 51 remains 51
                                        // 23 remains 23
                                        // -1 is turned into -3
                                        ) / 3 // 2) float division by 3
                                        // examples:
                                        // 51 is turned into 17
                                        // 23 is turned into 7.666…
                                        // -3 is turned back into -1
                                        >> 3 // 3) right arithmetic shift by 3 on the integer part
                                        // examples:
                                        // 17 becomes 2
                                        // 7.666… becomes 0
                                        // -1 is unchanged



                                        JavaScript (ES6), 26 bytes



                                        More straightforward, but less fun and 1 byte longer anyway.



                                        Takes input as (current)(delta).





                                        a=>b=>Math.floor((a+b)/24)


                                        Try it online!







                                        share|improve this answer














                                        share|improve this answer



                                        share|improve this answer








                                        edited 19 hours ago

























                                        answered yesterday









                                        ArnauldArnauld

                                        88.5k7 gold badges103 silver badges362 bronze badges




                                        88.5k7 gold badges103 silver badges362 bronze badges





















                                            3












                                            $begingroup$


                                            Python 3, 20 19 bytes



                                            Simple lambda:





                                            lambda*a:sum(a)//24


                                            -1 byte thanx to Jonathan Allan



                                            Try it online!



                                            Full program for 38 bytes:



                                            print((int(input())+int(input()))//24)





                                            share|improve this answer











                                            $endgroup$








                                            • 1




                                              $begingroup$
                                              Save a byte with *args like so: lambda*a:sum(a)//24. Switch to Python 2 and save another with lambda*a:sum(a)/24.
                                              $endgroup$
                                              – Jonathan Allan
                                              yesterday
















                                            3












                                            $begingroup$


                                            Python 3, 20 19 bytes



                                            Simple lambda:





                                            lambda*a:sum(a)//24


                                            -1 byte thanx to Jonathan Allan



                                            Try it online!



                                            Full program for 38 bytes:



                                            print((int(input())+int(input()))//24)





                                            share|improve this answer











                                            $endgroup$








                                            • 1




                                              $begingroup$
                                              Save a byte with *args like so: lambda*a:sum(a)//24. Switch to Python 2 and save another with lambda*a:sum(a)/24.
                                              $endgroup$
                                              – Jonathan Allan
                                              yesterday














                                            3












                                            3








                                            3





                                            $begingroup$


                                            Python 3, 20 19 bytes



                                            Simple lambda:





                                            lambda*a:sum(a)//24


                                            -1 byte thanx to Jonathan Allan



                                            Try it online!



                                            Full program for 38 bytes:



                                            print((int(input())+int(input()))//24)





                                            share|improve this answer











                                            $endgroup$




                                            Python 3, 20 19 bytes



                                            Simple lambda:





                                            lambda*a:sum(a)//24


                                            -1 byte thanx to Jonathan Allan



                                            Try it online!



                                            Full program for 38 bytes:



                                            print((int(input())+int(input()))//24)






                                            share|improve this answer














                                            share|improve this answer



                                            share|improve this answer








                                            edited yesterday

























                                            answered yesterday









                                            movaticamovatica

                                            4586 bronze badges




                                            4586 bronze badges







                                            • 1




                                              $begingroup$
                                              Save a byte with *args like so: lambda*a:sum(a)//24. Switch to Python 2 and save another with lambda*a:sum(a)/24.
                                              $endgroup$
                                              – Jonathan Allan
                                              yesterday













                                            • 1




                                              $begingroup$
                                              Save a byte with *args like so: lambda*a:sum(a)//24. Switch to Python 2 and save another with lambda*a:sum(a)/24.
                                              $endgroup$
                                              – Jonathan Allan
                                              yesterday








                                            1




                                            1




                                            $begingroup$
                                            Save a byte with *args like so: lambda*a:sum(a)//24. Switch to Python 2 and save another with lambda*a:sum(a)/24.
                                            $endgroup$
                                            – Jonathan Allan
                                            yesterday





                                            $begingroup$
                                            Save a byte with *args like so: lambda*a:sum(a)//24. Switch to Python 2 and save another with lambda*a:sum(a)/24.
                                            $endgroup$
                                            – Jonathan Allan
                                            yesterday












                                            2












                                            $begingroup$


                                            05AB1E (legacy), 4 bytes



                                            +24÷


                                            Try it online or verify all test cases.




                                            05AB1E, 11 5 bytes



                                            +24/ï


                                            -6 bytes by porting @Adam's approach in his APL answer.



                                            Try it online or verify all test cases.



                                            Explanation:





                                            + # Sum the two (implicit) input-integers together
                                            24÷ # Integer-divide this sum by 24
                                            # (after which the result is output implicitly)

                                            + # Sum the two (implicit) input-integers together
                                            24/ # Divide this sum by 24
                                            ï # Floor
                                            # (after which the result is output implicitly)


                                            The legacy version of 05AB1E uses a Python compiler. When integer-dividing, it will always floor the integer, whether the integer it divides is positive or negative.



                                            The new version of 05AB1E uses an Elixir compiler. When integer-dividing in the new version of 05AB1E, it will round towards 0 (so basically truncates the decimal digits after dividing). So this will floor for positive integers, but ceil for negative integers.






                                            share|improve this answer











                                            $endgroup$








                                            • 1




                                              $begingroup$
                                              5 bytes?
                                              $endgroup$
                                              – Expired Data
                                              yesterday










                                            • $begingroup$
                                              @ExpiredData Ah, noticed your comment after Adam's answer. But you're indeed right this can be done much easier.. Maybe I should just delete my answer out of shame and let you get the 5-byter. ;)
                                              $endgroup$
                                              – Kevin Cruijssen
                                              yesterday











                                            • $begingroup$
                                              nah I'm sure you'll pay me back in bytes saved given how terrible me 05AB1E is at the moment so don't worry!
                                              $endgroup$
                                              – Expired Data
                                              yesterday










                                            • $begingroup$
                                              @Adám That's what I initially had in mind when I saw the challenge, but it doesn't work for the [23,-24] and [23,-48] test cases. Which is why I had that weird 11 byter as my initial answer. Integer division will ceil for negative integers, instead of floor.
                                              $endgroup$
                                              – Kevin Cruijssen
                                              yesterday











                                            • $begingroup$
                                              Ah, so it rounds towards 0. Fair enough.
                                              $endgroup$
                                              – Adám
                                              yesterday















                                            2












                                            $begingroup$


                                            05AB1E (legacy), 4 bytes



                                            +24÷


                                            Try it online or verify all test cases.




                                            05AB1E, 11 5 bytes



                                            +24/ï


                                            -6 bytes by porting @Adam's approach in his APL answer.



                                            Try it online or verify all test cases.



                                            Explanation:





                                            + # Sum the two (implicit) input-integers together
                                            24÷ # Integer-divide this sum by 24
                                            # (after which the result is output implicitly)

                                            + # Sum the two (implicit) input-integers together
                                            24/ # Divide this sum by 24
                                            ï # Floor
                                            # (after which the result is output implicitly)


                                            The legacy version of 05AB1E uses a Python compiler. When integer-dividing, it will always floor the integer, whether the integer it divides is positive or negative.



                                            The new version of 05AB1E uses an Elixir compiler. When integer-dividing in the new version of 05AB1E, it will round towards 0 (so basically truncates the decimal digits after dividing). So this will floor for positive integers, but ceil for negative integers.






                                            share|improve this answer











                                            $endgroup$








                                            • 1




                                              $begingroup$
                                              5 bytes?
                                              $endgroup$
                                              – Expired Data
                                              yesterday










                                            • $begingroup$
                                              @ExpiredData Ah, noticed your comment after Adam's answer. But you're indeed right this can be done much easier.. Maybe I should just delete my answer out of shame and let you get the 5-byter. ;)
                                              $endgroup$
                                              – Kevin Cruijssen
                                              yesterday











                                            • $begingroup$
                                              nah I'm sure you'll pay me back in bytes saved given how terrible me 05AB1E is at the moment so don't worry!
                                              $endgroup$
                                              – Expired Data
                                              yesterday










                                            • $begingroup$
                                              @Adám That's what I initially had in mind when I saw the challenge, but it doesn't work for the [23,-24] and [23,-48] test cases. Which is why I had that weird 11 byter as my initial answer. Integer division will ceil for negative integers, instead of floor.
                                              $endgroup$
                                              – Kevin Cruijssen
                                              yesterday











                                            • $begingroup$
                                              Ah, so it rounds towards 0. Fair enough.
                                              $endgroup$
                                              – Adám
                                              yesterday













                                            2












                                            2








                                            2





                                            $begingroup$


                                            05AB1E (legacy), 4 bytes



                                            +24÷


                                            Try it online or verify all test cases.




                                            05AB1E, 11 5 bytes



                                            +24/ï


                                            -6 bytes by porting @Adam's approach in his APL answer.



                                            Try it online or verify all test cases.



                                            Explanation:





                                            + # Sum the two (implicit) input-integers together
                                            24÷ # Integer-divide this sum by 24
                                            # (after which the result is output implicitly)

                                            + # Sum the two (implicit) input-integers together
                                            24/ # Divide this sum by 24
                                            ï # Floor
                                            # (after which the result is output implicitly)


                                            The legacy version of 05AB1E uses a Python compiler. When integer-dividing, it will always floor the integer, whether the integer it divides is positive or negative.



                                            The new version of 05AB1E uses an Elixir compiler. When integer-dividing in the new version of 05AB1E, it will round towards 0 (so basically truncates the decimal digits after dividing). So this will floor for positive integers, but ceil for negative integers.






                                            share|improve this answer











                                            $endgroup$




                                            05AB1E (legacy), 4 bytes



                                            +24÷


                                            Try it online or verify all test cases.




                                            05AB1E, 11 5 bytes



                                            +24/ï


                                            -6 bytes by porting @Adam's approach in his APL answer.



                                            Try it online or verify all test cases.



                                            Explanation:





                                            + # Sum the two (implicit) input-integers together
                                            24÷ # Integer-divide this sum by 24
                                            # (after which the result is output implicitly)

                                            + # Sum the two (implicit) input-integers together
                                            24/ # Divide this sum by 24
                                            ï # Floor
                                            # (after which the result is output implicitly)


                                            The legacy version of 05AB1E uses a Python compiler. When integer-dividing, it will always floor the integer, whether the integer it divides is positive or negative.



                                            The new version of 05AB1E uses an Elixir compiler. When integer-dividing in the new version of 05AB1E, it will round towards 0 (so basically truncates the decimal digits after dividing). So this will floor for positive integers, but ceil for negative integers.







                                            share|improve this answer














                                            share|improve this answer



                                            share|improve this answer








                                            edited yesterday

























                                            answered yesterday









                                            Kevin CruijssenKevin Cruijssen

                                            48k7 gold badges83 silver badges241 bronze badges




                                            48k7 gold badges83 silver badges241 bronze badges







                                            • 1




                                              $begingroup$
                                              5 bytes?
                                              $endgroup$
                                              – Expired Data
                                              yesterday










                                            • $begingroup$
                                              @ExpiredData Ah, noticed your comment after Adam's answer. But you're indeed right this can be done much easier.. Maybe I should just delete my answer out of shame and let you get the 5-byter. ;)
                                              $endgroup$
                                              – Kevin Cruijssen
                                              yesterday











                                            • $begingroup$
                                              nah I'm sure you'll pay me back in bytes saved given how terrible me 05AB1E is at the moment so don't worry!
                                              $endgroup$
                                              – Expired Data
                                              yesterday










                                            • $begingroup$
                                              @Adám That's what I initially had in mind when I saw the challenge, but it doesn't work for the [23,-24] and [23,-48] test cases. Which is why I had that weird 11 byter as my initial answer. Integer division will ceil for negative integers, instead of floor.
                                              $endgroup$
                                              – Kevin Cruijssen
                                              yesterday











                                            • $begingroup$
                                              Ah, so it rounds towards 0. Fair enough.
                                              $endgroup$
                                              – Adám
                                              yesterday












                                            • 1




                                              $begingroup$
                                              5 bytes?
                                              $endgroup$
                                              – Expired Data
                                              yesterday










                                            • $begingroup$
                                              @ExpiredData Ah, noticed your comment after Adam's answer. But you're indeed right this can be done much easier.. Maybe I should just delete my answer out of shame and let you get the 5-byter. ;)
                                              $endgroup$
                                              – Kevin Cruijssen
                                              yesterday











                                            • $begingroup$
                                              nah I'm sure you'll pay me back in bytes saved given how terrible me 05AB1E is at the moment so don't worry!
                                              $endgroup$
                                              – Expired Data
                                              yesterday










                                            • $begingroup$
                                              @Adám That's what I initially had in mind when I saw the challenge, but it doesn't work for the [23,-24] and [23,-48] test cases. Which is why I had that weird 11 byter as my initial answer. Integer division will ceil for negative integers, instead of floor.
                                              $endgroup$
                                              – Kevin Cruijssen
                                              yesterday











                                            • $begingroup$
                                              Ah, so it rounds towards 0. Fair enough.
                                              $endgroup$
                                              – Adám
                                              yesterday







                                            1




                                            1




                                            $begingroup$
                                            5 bytes?
                                            $endgroup$
                                            – Expired Data
                                            yesterday




                                            $begingroup$
                                            5 bytes?
                                            $endgroup$
                                            – Expired Data
                                            yesterday












                                            $begingroup$
                                            @ExpiredData Ah, noticed your comment after Adam's answer. But you're indeed right this can be done much easier.. Maybe I should just delete my answer out of shame and let you get the 5-byter. ;)
                                            $endgroup$
                                            – Kevin Cruijssen
                                            yesterday





                                            $begingroup$
                                            @ExpiredData Ah, noticed your comment after Adam's answer. But you're indeed right this can be done much easier.. Maybe I should just delete my answer out of shame and let you get the 5-byter. ;)
                                            $endgroup$
                                            – Kevin Cruijssen
                                            yesterday













                                            $begingroup$
                                            nah I'm sure you'll pay me back in bytes saved given how terrible me 05AB1E is at the moment so don't worry!
                                            $endgroup$
                                            – Expired Data
                                            yesterday




                                            $begingroup$
                                            nah I'm sure you'll pay me back in bytes saved given how terrible me 05AB1E is at the moment so don't worry!
                                            $endgroup$
                                            – Expired Data
                                            yesterday












                                            $begingroup$
                                            @Adám That's what I initially had in mind when I saw the challenge, but it doesn't work for the [23,-24] and [23,-48] test cases. Which is why I had that weird 11 byter as my initial answer. Integer division will ceil for negative integers, instead of floor.
                                            $endgroup$
                                            – Kevin Cruijssen
                                            yesterday





                                            $begingroup$
                                            @Adám That's what I initially had in mind when I saw the challenge, but it doesn't work for the [23,-24] and [23,-48] test cases. Which is why I had that weird 11 byter as my initial answer. Integer division will ceil for negative integers, instead of floor.
                                            $endgroup$
                                            – Kevin Cruijssen
                                            yesterday













                                            $begingroup$
                                            Ah, so it rounds towards 0. Fair enough.
                                            $endgroup$
                                            – Adám
                                            yesterday




                                            $begingroup$
                                            Ah, so it rounds towards 0. Fair enough.
                                            $endgroup$
                                            – Adám
                                            yesterday











                                            1












                                            $begingroup$


                                            Ohm v2, 4 bytes



                                            +24v


                                            Try it online!






                                            share|improve this answer









                                            $endgroup$

















                                              1












                                              $begingroup$


                                              Ohm v2, 4 bytes



                                              +24v


                                              Try it online!






                                              share|improve this answer









                                              $endgroup$















                                                1












                                                1








                                                1





                                                $begingroup$


                                                Ohm v2, 4 bytes



                                                +24v


                                                Try it online!






                                                share|improve this answer









                                                $endgroup$




                                                Ohm v2, 4 bytes



                                                +24v


                                                Try it online!







                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered yesterday









                                                CinaskiCinaski

                                                1,3781 gold badge3 silver badges15 bronze badges




                                                1,3781 gold badge3 silver badges15 bronze badges





















                                                    1












                                                    $begingroup$


                                                    C# (Visual C# Interactive Compiler), 26 bytes





                                                    a=>b=>Math.Floor((a+b)/24)


                                                    Try it online!






                                                    share|improve this answer









                                                    $endgroup$

















                                                      1












                                                      $begingroup$


                                                      C# (Visual C# Interactive Compiler), 26 bytes





                                                      a=>b=>Math.Floor((a+b)/24)


                                                      Try it online!






                                                      share|improve this answer









                                                      $endgroup$















                                                        1












                                                        1








                                                        1





                                                        $begingroup$


                                                        C# (Visual C# Interactive Compiler), 26 bytes





                                                        a=>b=>Math.Floor((a+b)/24)


                                                        Try it online!






                                                        share|improve this answer









                                                        $endgroup$




                                                        C# (Visual C# Interactive Compiler), 26 bytes





                                                        a=>b=>Math.Floor((a+b)/24)


                                                        Try it online!







                                                        share|improve this answer












                                                        share|improve this answer



                                                        share|improve this answer










                                                        answered yesterday









                                                        Embodiment of IgnoranceEmbodiment of Ignorance

                                                        4,5461 silver badge28 bronze badges




                                                        4,5461 silver badge28 bronze badges





















                                                            1












                                                            $begingroup$


                                                            Haskell, 18 bytes





                                                            (flip(div)24.).(+)


                                                            Try it online!




                                                            I've seen people leave off the function declaration in the byte count for pointfree style, so I'm doing the same here.



                                                            Explanation:



                                                            flip(div)24


                                                            First, div is the shorter integer division operator, but it takes in its arguments as x//24 => div x 24, so we need to use flip so that we can partially apply it to 24.



                                                            The double composition is a little weird to explain, so I'll follow the template of this great SO answer:



                                                            f a b = (flip(div)24) (a + b) -- what we want
                                                            f a b = (flip(div)24) ((+) a b) -- un-infixing (+)
                                                            f a b = ((flip(div)24) . ((+) a)) b -- definition of function composition (partially applying (+) onto a)
                                                            f a = (flip(div)24) . ((+) a) -- pointfree reduction
                                                            f a = ((flip(div)24) .) ((+) a) -- associative property
                                                            f a = (((flip(div)24) .) . (+)) a -- definition of function composition
                                                            f = (flip(div)24.) . (+) -- pointfree reduction





                                                            share|improve this answer











                                                            $endgroup$












                                                            • $begingroup$
                                                              You can use backquotes instead of flip: ((`div`24).).(+).
                                                              $endgroup$
                                                              – nimi
                                                              18 hours ago















                                                            1












                                                            $begingroup$


                                                            Haskell, 18 bytes





                                                            (flip(div)24.).(+)


                                                            Try it online!




                                                            I've seen people leave off the function declaration in the byte count for pointfree style, so I'm doing the same here.



                                                            Explanation:



                                                            flip(div)24


                                                            First, div is the shorter integer division operator, but it takes in its arguments as x//24 => div x 24, so we need to use flip so that we can partially apply it to 24.



                                                            The double composition is a little weird to explain, so I'll follow the template of this great SO answer:



                                                            f a b = (flip(div)24) (a + b) -- what we want
                                                            f a b = (flip(div)24) ((+) a b) -- un-infixing (+)
                                                            f a b = ((flip(div)24) . ((+) a)) b -- definition of function composition (partially applying (+) onto a)
                                                            f a = (flip(div)24) . ((+) a) -- pointfree reduction
                                                            f a = ((flip(div)24) .) ((+) a) -- associative property
                                                            f a = (((flip(div)24) .) . (+)) a -- definition of function composition
                                                            f = (flip(div)24.) . (+) -- pointfree reduction





                                                            share|improve this answer











                                                            $endgroup$












                                                            • $begingroup$
                                                              You can use backquotes instead of flip: ((`div`24).).(+).
                                                              $endgroup$
                                                              – nimi
                                                              18 hours ago













                                                            1












                                                            1








                                                            1





                                                            $begingroup$


                                                            Haskell, 18 bytes





                                                            (flip(div)24.).(+)


                                                            Try it online!




                                                            I've seen people leave off the function declaration in the byte count for pointfree style, so I'm doing the same here.



                                                            Explanation:



                                                            flip(div)24


                                                            First, div is the shorter integer division operator, but it takes in its arguments as x//24 => div x 24, so we need to use flip so that we can partially apply it to 24.



                                                            The double composition is a little weird to explain, so I'll follow the template of this great SO answer:



                                                            f a b = (flip(div)24) (a + b) -- what we want
                                                            f a b = (flip(div)24) ((+) a b) -- un-infixing (+)
                                                            f a b = ((flip(div)24) . ((+) a)) b -- definition of function composition (partially applying (+) onto a)
                                                            f a = (flip(div)24) . ((+) a) -- pointfree reduction
                                                            f a = ((flip(div)24) .) ((+) a) -- associative property
                                                            f a = (((flip(div)24) .) . (+)) a -- definition of function composition
                                                            f = (flip(div)24.) . (+) -- pointfree reduction





                                                            share|improve this answer











                                                            $endgroup$




                                                            Haskell, 18 bytes





                                                            (flip(div)24.).(+)


                                                            Try it online!




                                                            I've seen people leave off the function declaration in the byte count for pointfree style, so I'm doing the same here.



                                                            Explanation:



                                                            flip(div)24


                                                            First, div is the shorter integer division operator, but it takes in its arguments as x//24 => div x 24, so we need to use flip so that we can partially apply it to 24.



                                                            The double composition is a little weird to explain, so I'll follow the template of this great SO answer:



                                                            f a b = (flip(div)24) (a + b) -- what we want
                                                            f a b = (flip(div)24) ((+) a b) -- un-infixing (+)
                                                            f a b = ((flip(div)24) . ((+) a)) b -- definition of function composition (partially applying (+) onto a)
                                                            f a = (flip(div)24) . ((+) a) -- pointfree reduction
                                                            f a = ((flip(div)24) .) ((+) a) -- associative property
                                                            f a = (((flip(div)24) .) . (+)) a -- definition of function composition
                                                            f = (flip(div)24.) . (+) -- pointfree reduction






                                                            share|improve this answer














                                                            share|improve this answer



                                                            share|improve this answer








                                                            edited yesterday

























                                                            answered yesterday









                                                            Rin's Fourier transformRin's Fourier transform

                                                            5274 silver badges11 bronze badges




                                                            5274 silver badges11 bronze badges











                                                            • $begingroup$
                                                              You can use backquotes instead of flip: ((`div`24).).(+).
                                                              $endgroup$
                                                              – nimi
                                                              18 hours ago
















                                                            • $begingroup$
                                                              You can use backquotes instead of flip: ((`div`24).).(+).
                                                              $endgroup$
                                                              – nimi
                                                              18 hours ago















                                                            $begingroup$
                                                            You can use backquotes instead of flip: ((`div`24).).(+).
                                                            $endgroup$
                                                            – nimi
                                                            18 hours ago




                                                            $begingroup$
                                                            You can use backquotes instead of flip: ((`div`24).).(+).
                                                            $endgroup$
                                                            – nimi
                                                            18 hours ago











                                                            1












                                                            $begingroup$


                                                            R, 28 16 bytes



                                                            Just a port of most of the other answers...

                                                            -12 bytes thanks Giuseppe



                                                            sum(scan())%/%24


                                                            Try it online!






                                                            share|improve this answer











                                                            $endgroup$












                                                            • $begingroup$
                                                              Use x%/%y instead of floor(x/y)
                                                              $endgroup$
                                                              – Giuseppe
                                                              yesterday






                                                            • 1




                                                              $begingroup$
                                                              Or better yet, take input from stdin and do sum(scan())%/%24
                                                              $endgroup$
                                                              – Giuseppe
                                                              yesterday










                                                            • $begingroup$
                                                              Nice one. Will have to remember that trick.
                                                              $endgroup$
                                                              – Robert S.
                                                              yesterday















                                                            1












                                                            $begingroup$


                                                            R, 28 16 bytes



                                                            Just a port of most of the other answers...

                                                            -12 bytes thanks Giuseppe



                                                            sum(scan())%/%24


                                                            Try it online!






                                                            share|improve this answer











                                                            $endgroup$












                                                            • $begingroup$
                                                              Use x%/%y instead of floor(x/y)
                                                              $endgroup$
                                                              – Giuseppe
                                                              yesterday






                                                            • 1




                                                              $begingroup$
                                                              Or better yet, take input from stdin and do sum(scan())%/%24
                                                              $endgroup$
                                                              – Giuseppe
                                                              yesterday










                                                            • $begingroup$
                                                              Nice one. Will have to remember that trick.
                                                              $endgroup$
                                                              – Robert S.
                                                              yesterday













                                                            1












                                                            1








                                                            1





                                                            $begingroup$


                                                            R, 28 16 bytes



                                                            Just a port of most of the other answers...

                                                            -12 bytes thanks Giuseppe



                                                            sum(scan())%/%24


                                                            Try it online!






                                                            share|improve this answer











                                                            $endgroup$




                                                            R, 28 16 bytes



                                                            Just a port of most of the other answers...

                                                            -12 bytes thanks Giuseppe



                                                            sum(scan())%/%24


                                                            Try it online!







                                                            share|improve this answer














                                                            share|improve this answer



                                                            share|improve this answer








                                                            edited yesterday

























                                                            answered yesterday









                                                            Robert S.Robert S.

                                                            8485 silver badges15 bronze badges




                                                            8485 silver badges15 bronze badges











                                                            • $begingroup$
                                                              Use x%/%y instead of floor(x/y)
                                                              $endgroup$
                                                              – Giuseppe
                                                              yesterday






                                                            • 1




                                                              $begingroup$
                                                              Or better yet, take input from stdin and do sum(scan())%/%24
                                                              $endgroup$
                                                              – Giuseppe
                                                              yesterday










                                                            • $begingroup$
                                                              Nice one. Will have to remember that trick.
                                                              $endgroup$
                                                              – Robert S.
                                                              yesterday
















                                                            • $begingroup$
                                                              Use x%/%y instead of floor(x/y)
                                                              $endgroup$
                                                              – Giuseppe
                                                              yesterday






                                                            • 1




                                                              $begingroup$
                                                              Or better yet, take input from stdin and do sum(scan())%/%24
                                                              $endgroup$
                                                              – Giuseppe
                                                              yesterday










                                                            • $begingroup$
                                                              Nice one. Will have to remember that trick.
                                                              $endgroup$
                                                              – Robert S.
                                                              yesterday















                                                            $begingroup$
                                                            Use x%/%y instead of floor(x/y)
                                                            $endgroup$
                                                            – Giuseppe
                                                            yesterday




                                                            $begingroup$
                                                            Use x%/%y instead of floor(x/y)
                                                            $endgroup$
                                                            – Giuseppe
                                                            yesterday




                                                            1




                                                            1




                                                            $begingroup$
                                                            Or better yet, take input from stdin and do sum(scan())%/%24
                                                            $endgroup$
                                                            – Giuseppe
                                                            yesterday




                                                            $begingroup$
                                                            Or better yet, take input from stdin and do sum(scan())%/%24
                                                            $endgroup$
                                                            – Giuseppe
                                                            yesterday












                                                            $begingroup$
                                                            Nice one. Will have to remember that trick.
                                                            $endgroup$
                                                            – Robert S.
                                                            yesterday




                                                            $begingroup$
                                                            Nice one. Will have to remember that trick.
                                                            $endgroup$
                                                            – Robert S.
                                                            yesterday











                                                            0












                                                            $begingroup$


                                                            Lua, 70 bytes





                                                            s=io.read()
                                                            c,d=s:match("([^,]+),([^,]+)")
                                                            print(math.floor((c+d)/24))


                                                            Try it online!






                                                            share|improve this answer









                                                            $endgroup$

















                                                              0












                                                              $begingroup$


                                                              Lua, 70 bytes





                                                              s=io.read()
                                                              c,d=s:match("([^,]+),([^,]+)")
                                                              print(math.floor((c+d)/24))


                                                              Try it online!






                                                              share|improve this answer









                                                              $endgroup$















                                                                0












                                                                0








                                                                0





                                                                $begingroup$


                                                                Lua, 70 bytes





                                                                s=io.read()
                                                                c,d=s:match("([^,]+),([^,]+)")
                                                                print(math.floor((c+d)/24))


                                                                Try it online!






                                                                share|improve this answer









                                                                $endgroup$




                                                                Lua, 70 bytes





                                                                s=io.read()
                                                                c,d=s:match("([^,]+),([^,]+)")
                                                                print(math.floor((c+d)/24))


                                                                Try it online!







                                                                share|improve this answer












                                                                share|improve this answer



                                                                share|improve this answer










                                                                answered yesterday









                                                                ouflakouflak

                                                                3401 gold badge5 silver badges16 bronze badges




                                                                3401 gold badge5 silver badges16 bronze badges





















                                                                    0












                                                                    $begingroup$


                                                                    I, 6 bytes



                                                                    Anonymous tacit infix function, taking current and delta as arguments.



                                                                    +/24.m


                                                                    Try it online!



                                                                    Beginning with:



                                                                    + the sum of the arguments



                                                                    / divide by:



                                                                    24 twentyfour



                                                                    . apply:



                                                                    m floor (minimum)






                                                                    share|improve this answer









                                                                    $endgroup$

















                                                                      0












                                                                      $begingroup$


                                                                      I, 6 bytes



                                                                      Anonymous tacit infix function, taking current and delta as arguments.



                                                                      +/24.m


                                                                      Try it online!



                                                                      Beginning with:



                                                                      + the sum of the arguments



                                                                      / divide by:



                                                                      24 twentyfour



                                                                      . apply:



                                                                      m floor (minimum)






                                                                      share|improve this answer









                                                                      $endgroup$















                                                                        0












                                                                        0








                                                                        0





                                                                        $begingroup$


                                                                        I, 6 bytes



                                                                        Anonymous tacit infix function, taking current and delta as arguments.



                                                                        +/24.m


                                                                        Try it online!



                                                                        Beginning with:



                                                                        + the sum of the arguments



                                                                        / divide by:



                                                                        24 twentyfour



                                                                        . apply:



                                                                        m floor (minimum)






                                                                        share|improve this answer









                                                                        $endgroup$




                                                                        I, 6 bytes



                                                                        Anonymous tacit infix function, taking current and delta as arguments.



                                                                        +/24.m


                                                                        Try it online!



                                                                        Beginning with:



                                                                        + the sum of the arguments



                                                                        / divide by:



                                                                        24 twentyfour



                                                                        . apply:



                                                                        m floor (minimum)







                                                                        share|improve this answer












                                                                        share|improve this answer



                                                                        share|improve this answer










                                                                        answered yesterday









                                                                        AdámAdám

                                                                        29k2 gold badges79 silver badges212 bronze badges




                                                                        29k2 gold badges79 silver badges212 bronze badges





















                                                                            0












                                                                            $begingroup$


                                                                            Retina 0.8.2, 41 bytes



                                                                            d+,?
                                                                            $*
                                                                            (1+)-1
                                                                            -
                                                                            ^((-)1|124)*.*
                                                                            $2$#1


                                                                            Try it online! Link includes test suite. Explanation:



                                                                            d+,?
                                                                            $*


                                                                            Convert both inputs to unary and take the sum if the second input is positive.



                                                                            (1+)-1
                                                                            -


                                                                            But if the second input is negative then take the difference.



                                                                            ^((-)1|124)*.*
                                                                            $2$#1


                                                                            Floor divide the input by 24 and convert to decimal. For positive numbers the first alternation never matches so this just counts the number of whole multiples of 24 in the number. For negative numbers the leading -1 counts as an extra negative multiple of 24 in addition to any remaining multiples of 24, thus achieving the desired floor division.






                                                                            share|improve this answer









                                                                            $endgroup$

















                                                                              0












                                                                              $begingroup$


                                                                              Retina 0.8.2, 41 bytes



                                                                              d+,?
                                                                              $*
                                                                              (1+)-1
                                                                              -
                                                                              ^((-)1|124)*.*
                                                                              $2$#1


                                                                              Try it online! Link includes test suite. Explanation:



                                                                              d+,?
                                                                              $*


                                                                              Convert both inputs to unary and take the sum if the second input is positive.



                                                                              (1+)-1
                                                                              -


                                                                              But if the second input is negative then take the difference.



                                                                              ^((-)1|124)*.*
                                                                              $2$#1


                                                                              Floor divide the input by 24 and convert to decimal. For positive numbers the first alternation never matches so this just counts the number of whole multiples of 24 in the number. For negative numbers the leading -1 counts as an extra negative multiple of 24 in addition to any remaining multiples of 24, thus achieving the desired floor division.






                                                                              share|improve this answer









                                                                              $endgroup$















                                                                                0












                                                                                0








                                                                                0





                                                                                $begingroup$


                                                                                Retina 0.8.2, 41 bytes



                                                                                d+,?
                                                                                $*
                                                                                (1+)-1
                                                                                -
                                                                                ^((-)1|124)*.*
                                                                                $2$#1


                                                                                Try it online! Link includes test suite. Explanation:



                                                                                d+,?
                                                                                $*


                                                                                Convert both inputs to unary and take the sum if the second input is positive.



                                                                                (1+)-1
                                                                                -


                                                                                But if the second input is negative then take the difference.



                                                                                ^((-)1|124)*.*
                                                                                $2$#1


                                                                                Floor divide the input by 24 and convert to decimal. For positive numbers the first alternation never matches so this just counts the number of whole multiples of 24 in the number. For negative numbers the leading -1 counts as an extra negative multiple of 24 in addition to any remaining multiples of 24, thus achieving the desired floor division.






                                                                                share|improve this answer









                                                                                $endgroup$




                                                                                Retina 0.8.2, 41 bytes



                                                                                d+,?
                                                                                $*
                                                                                (1+)-1
                                                                                -
                                                                                ^((-)1|124)*.*
                                                                                $2$#1


                                                                                Try it online! Link includes test suite. Explanation:



                                                                                d+,?
                                                                                $*


                                                                                Convert both inputs to unary and take the sum if the second input is positive.



                                                                                (1+)-1
                                                                                -


                                                                                But if the second input is negative then take the difference.



                                                                                ^((-)1|124)*.*
                                                                                $2$#1


                                                                                Floor divide the input by 24 and convert to decimal. For positive numbers the first alternation never matches so this just counts the number of whole multiples of 24 in the number. For negative numbers the leading -1 counts as an extra negative multiple of 24 in addition to any remaining multiples of 24, thus achieving the desired floor division.







                                                                                share|improve this answer












                                                                                share|improve this answer



                                                                                share|improve this answer










                                                                                answered yesterday









                                                                                NeilNeil

                                                                                86.5k8 gold badges46 silver badges183 bronze badges




                                                                                86.5k8 gold badges46 silver badges183 bronze badges





















                                                                                    0












                                                                                    $begingroup$


                                                                                    Python 2, 18 bytes



                                                                                    lambda*a:sum(a)/24


                                                                                    Try it online!






                                                                                    share|improve this answer









                                                                                    $endgroup$

















                                                                                      0












                                                                                      $begingroup$


                                                                                      Python 2, 18 bytes



                                                                                      lambda*a:sum(a)/24


                                                                                      Try it online!






                                                                                      share|improve this answer









                                                                                      $endgroup$















                                                                                        0












                                                                                        0








                                                                                        0





                                                                                        $begingroup$


                                                                                        Python 2, 18 bytes



                                                                                        lambda*a:sum(a)/24


                                                                                        Try it online!






                                                                                        share|improve this answer









                                                                                        $endgroup$




                                                                                        Python 2, 18 bytes



                                                                                        lambda*a:sum(a)/24


                                                                                        Try it online!







                                                                                        share|improve this answer












                                                                                        share|improve this answer



                                                                                        share|improve this answer










                                                                                        answered 43 mins ago









                                                                                        U10-ForwardU10-Forward

                                                                                        2314 bronze badges




                                                                                        2314 bronze badges




















                                                                                            Ivan Gerasimenko is a new contributor. Be nice, and check out our Code of Conduct.









                                                                                            draft saved

                                                                                            draft discarded


















                                                                                            Ivan Gerasimenko is a new contributor. Be nice, and check out our Code of Conduct.












                                                                                            Ivan Gerasimenko is a new contributor. Be nice, and check out our Code of Conduct.











                                                                                            Ivan Gerasimenko is a new contributor. Be nice, and check out our Code of Conduct.














                                                                                            If this is an answer to a challenge…



                                                                                            • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                                                                                            • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                                                                                              Explanations of your answer make it more interesting to read and are very much encouraged.


                                                                                            • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.


                                                                                            More generally…



                                                                                            • …Please make sure to answer the question and provide sufficient detail.


                                                                                            • …Avoid asking for help, clarification or responding to other answers (use comments instead).




                                                                                            draft saved


                                                                                            draft discarded














                                                                                            StackExchange.ready(
                                                                                            function ()
                                                                                            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f188809%2fget-delta-of-days-by-current-hour-and-added-delta-of-days%23new-answer', 'question_page');

                                                                                            );

                                                                                            Post as a guest















                                                                                            Required, but never shown





















































                                                                                            Required, but never shown














                                                                                            Required, but never shown












                                                                                            Required, but never shown







                                                                                            Required, but never shown

































                                                                                            Required, but never shown














                                                                                            Required, but never shown












                                                                                            Required, but never shown







                                                                                            Required, but never shown







                                                                                            Popular posts from this blog

                                                                                            Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

                                                                                            Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

                                                                                            Ласкавець круглолистий Зміст Опис | Поширення | Галерея | Примітки | Посилання | Навігаційне меню58171138361-22960890446Bupleurum rotundifoliumEuro+Med PlantbasePlants of the World Online — Kew ScienceGermplasm Resources Information Network (GRIN)Ласкавецькн. VI : Літери Ком — Левиправивши або дописавши її