Skip to main content
added 10 characters in body
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282
“Ḳœẹ“rɓ?’ḃ5×5“ZO‘;"Ä⁸>§I‘ - Main Link: integer, Y  e.g. 129
“Ḳœẹ“rɓ?’                 - list of (two) base-250 integers = [11132965,7226564]
         ḃ5               - convert to bijective base five -> [[5,3,2,2,2,2,3,3,2,5],[3,3,2,2,2,2,2,2,2,4]]
           ×5             - multiply by five -> [[25,15,10,10,10,10,15,15,10,25],[15,15,10,10,10,10,10,10,10,20]]
             “ZO‘         - list of code-page indices = [90,79]
                  "       - zip with:
                 ;        -   concatenation -> [[90,25,15,10,10,10,10,15,15,10,25],[79,15,15,10,10,10,10,10,10,10,20]]
                   Ä      - Cumulative values -> [[90,115,130,140,150,160,170,185,200,210,235],[79,94,109,119,129,139,149,159,169,179,199]]
                    ⁸>    - is Y greater than (those)? -> [[1,1,0,0,0,0,0,0,0,0,0],[1,1,1,1,0,0,0,0,0,0,0]]
                      §   - sums -> [2,4]
                       I  - deltas -> [2]
                        ‘ - increment -> [3]
                          - implicit print -> "3"
“Ḳœẹ“rɓ?’ḃ5×5“ZO‘;"Ä⁸>§I‘ - Main Link: integer, Y  e.g. 129
“Ḳœẹ“rɓ?’                 - list of (two) base-250 integers = [11132965,7226564]
         ḃ5               - convert to base five -> [[5,3,2,2,2,2,3,3,2,5],[3,3,2,2,2,2,2,2,2,4]]
           ×5             - multiply by five -> [[25,15,10,10,10,10,15,15,10,25],[15,15,10,10,10,10,10,10,10,20]]
             “ZO‘         - list of code-page indices = [90,79]
                  "       - zip with:
                 ;        -   concatenation -> [[90,25,15,10,10,10,10,15,15,10,25],[79,15,15,10,10,10,10,10,10,10,20]]
                   Ä      - Cumulative values -> [[90,115,130,140,150,160,170,185,200,210,235],[79,94,109,119,129,139,149,159,169,179,199]]
                    ⁸>    - is Y greater than (those)? -> [[1,1,0,0,0,0,0,0,0,0,0],[1,1,1,1,0,0,0,0,0,0,0]]
                      §   - sums -> [2,4]
                       I  - deltas -> [2]
                        ‘ - increment -> [3]
                          - implicit print -> "3"
“Ḳœẹ“rɓ?’ḃ5×5“ZO‘;"Ä⁸>§I‘ - Main Link: integer, Y  e.g. 129
“Ḳœẹ“rɓ?’                 - list of (two) base-250 integers = [11132965,7226564]
         ḃ5               - convert to bijective base five -> [[5,3,2,2,2,2,3,3,2,5],[3,3,2,2,2,2,2,2,2,4]]
           ×5             - multiply by five -> [[25,15,10,10,10,10,15,15,10,25],[15,15,10,10,10,10,10,10,10,20]]
             “ZO‘         - list of code-page indices = [90,79]
                  "       - zip with:
                 ;        -   concatenation -> [[90,25,15,10,10,10,10,15,15,10,25],[79,15,15,10,10,10,10,10,10,10,20]]
                   Ä      - Cumulative values -> [[90,115,130,140,150,160,170,185,200,210,235],[79,94,109,119,129,139,149,159,169,179,199]]
                    ⁸>    - is Y greater than (those)? -> [[1,1,0,0,0,0,0,0,0,0,0],[1,1,1,1,0,0,0,0,0,0,0]]
                      §   - sums -> [2,4]
                       I  - deltas -> [2]
                        ‘ - increment -> [3]
                          - implicit print -> "3"
added 1488 characters in body
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

How?

For any valid input, in \$[60,260]\$ we are able to use at least one club. For any given yardage, in \$[61,260]\$, we are able to use either the same, one more, or one less club than we could have done for one yard less. The code below encodes the yardages at which the number of available clubs goes up, and those at which the number of available clubs goes down and uses that to calculate the result.

“Ḳœẹ“rɓ?’ḃ5×5“ZO‘;"Ä⁸>§I‘ - Main Link: integer, Y  e.g. 129
“Ḳœẹ“rɓ?’                 - list of (two) base-250 integers = [11132965,7226564]
         ḃ5               - convert to base five -> [[5,3,2,2,2,2,3,3,2,5],[3,3,2,2,2,2,2,2,2,4]]
           ×5             - multiply by five -> [[25,15,10,10,10,10,15,15,10,25],[15,15,10,10,10,10,10,10,10,20]]
             “ZO‘         - list of code-page indices = [90,79]
                  "       - zip with:
                 ;        -   concatenation -> [[90,25,15,10,10,10,10,15,15,10,25],[79,15,15,10,10,10,10,10,10,10,20]]
                   Ä      - Cumulative values -> [[90,115,130,140,150,160,170,185,200,210,235],[79,94,109,119,129,139,149,159,169,179,199]]
                    ⁸>    - is Y greater than (those)? -> [[1,1,0,0,0,0,0,0,0,0,0],[1,1,1,1,0,0,0,0,0,0,0]]
                      §   - sums -> [2,4]
                       I  - deltas -> [2]
                        ‘ - increment -> [3]
                          - implicit print -> "3"

How?

For any valid input, in \$[60,260]\$ we are able to use at least one club. For any given yardage, in \$[61,260]\$, we are able to use either the same, one more, or one less club than we could have done for one yard less. The code below encodes the yardages at which the number of available clubs goes up, and those at which the number of available clubs goes down and uses that to calculate the result.

“Ḳœẹ“rɓ?’ḃ5×5“ZO‘;"Ä⁸>§I‘ - Main Link: integer, Y  e.g. 129
“Ḳœẹ“rɓ?’                 - list of (two) base-250 integers = [11132965,7226564]
         ḃ5               - convert to base five -> [[5,3,2,2,2,2,3,3,2,5],[3,3,2,2,2,2,2,2,2,4]]
           ×5             - multiply by five -> [[25,15,10,10,10,10,15,15,10,25],[15,15,10,10,10,10,10,10,10,20]]
             “ZO‘         - list of code-page indices = [90,79]
                  "       - zip with:
                 ;        -   concatenation -> [[90,25,15,10,10,10,10,15,15,10,25],[79,15,15,10,10,10,10,10,10,10,20]]
                   Ä      - Cumulative values -> [[90,115,130,140,150,160,170,185,200,210,235],[79,94,109,119,129,139,149,159,169,179,199]]
                    ⁸>    - is Y greater than (those)? -> [[1,1,0,0,0,0,0,0,0,0,0],[1,1,1,1,0,0,0,0,0,0,0]]
                      §   - sums -> [2,4]
                       I  - deltas -> [2]
                        ‘ - increment -> [3]
                          - implicit print -> "3"
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

Jelly, 25 bytes

“Ḳœẹ“rɓ?’ḃ5×5“ZO‘;"Ä⁸>§I‘

A full program which prints the result (or a monadic Link which returns a single-element list).

Try it online! Or see the test-suite.