Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Commonmark migration
Source Link

#J - (削除) 32 (削除ここまで)(削除) 29 (削除ここまで)(削除) 28 (削除ここまで) 25

J - (削除) 32 (削除ここまで)(削除) 29 (削除ここまで)(削除) 28 (削除ここまで) 25

(削除) Not (削除ここまで) shorter than other J solution, (削除) but (削除ここまで) and uses a different idea

(]{.[:i:-:@-.@]-%)/ ::_1:

The answer for the number of coins the highest rank gnome is getting is simply N/M+(M-1)/2 (if it's an integer), we construct the negative of this -:@-.@]-%. Then i: makes an array like that 2 1 0 _1 _2 for argument _2 and we take M elements from it.

#J - (削除) 32 (削除ここまで)(削除) 29 (削除ここまで)(削除) 28 (削除ここまで) 25

(削除) Not (削除ここまで) shorter than other J solution, (削除) but (削除ここまで) and uses a different idea

(]{.[:i:-:@-.@]-%)/ ::_1:

The answer for the number of coins the highest rank gnome is getting is simply N/M+(M-1)/2 (if it's an integer), we construct the negative of this -:@-.@]-%. Then i: makes an array like that 2 1 0 _1 _2 for argument _2 and we take M elements from it.

J - (削除) 32 (削除ここまで)(削除) 29 (削除ここまで)(削除) 28 (削除ここまで) 25

(削除) Not (削除ここまで) shorter than other J solution, (削除) but (削除ここまで) and uses a different idea

(]{.[:i:-:@-.@]-%)/ ::_1:

The answer for the number of coins the highest rank gnome is getting is simply N/M+(M-1)/2 (if it's an integer), we construct the negative of this -:@-.@]-%. Then i: makes an array like that 2 1 0 _1 _2 for argument _2 and we take M elements from it.

added 6 characters in body
Source Link
swish
  • 7.8k
  • 3
  • 23
  • 30

#J - (削除) 32 (削除ここまで) (削除) 29 (削除ここまで) 28(削除) 28 (削除ここまで) 25

(削除) Not (削除ここまで) shorter than other J solution, (削除) but (削除ここまで) and uses a different idea

(]{.[:i:-:@(1-]).@]-[%]%)/ ::_1:

The answer for the number of coins the highest rank gnome is getting is simply N/M+(M-1)/2 (if it's an integer), we construct the negative of this (-:@(1-]).@]-[%])%. Then i: makes an array like that 2 1 0 _1 _2 for argument _2 and we take M elements from it.

#J - (削除) 32 (削除ここまで) (削除) 29 (削除ここまで) 28

(削除) Not (削除ここまで) shorter than other J solution, (削除) but (削除ここまで) and uses a different idea

(]{.[:i:-:@(1-])-[%])/ ::_1:

The answer for the number of coins the highest rank gnome is getting is simply N/M+(M-1)/2 (if it's an integer), we construct the negative of this (-:@(1-])-[%]). Then i: makes an array like that 2 1 0 _1 _2 for argument _2 and we take M elements from it.

#J - (削除) 32 (削除ここまで) (削除) 29 (削除ここまで) (削除) 28 (削除ここまで) 25

(削除) Not (削除ここまで) shorter than other J solution, (削除) but (削除ここまで) and uses a different idea

(]{.[:i:-:@-.@]-%)/ ::_1:

The answer for the number of coins the highest rank gnome is getting is simply N/M+(M-1)/2 (if it's an integer), we construct the negative of this -:@-.@]-%. Then i: makes an array like that 2 1 0 _1 _2 for argument _2 and we take M elements from it.

deleted 95 characters in body
Source Link
swish
  • 7.8k
  • 3
  • 23
  • 30

#J - (削除) 32 (削除ここまで) (削除) 29 (削除ここまで) 28

(削除) Not (削除ここまで) shorter than other J solution, (削除) but (削除ここまで) and uses a different idea

(]{.[:i:-:@(1-])-[%])/ ::_1:

Here is Wolfram Language ungolfing

If[IntegerQ@#,Range[#,#-m+1,-1],-1]&[n/m+(m-1)/2]

The answer for the number of coins the highest rank gnome is getting is simply N/M+(M-1)/2 (if it's an integer), we construct the negative of this (-:@(1-])-[%]). Then i: makes an array like that 2 1 0 _1 _2 for argument _2 and we take M elements from it.

#J - (削除) 32 (削除ここまで) (削除) 29 (削除ここまで) 28

(削除) Not (削除ここまで) shorter than other J solution, (削除) but (削除ここまで) and uses a different idea

(]{.[:i:-:@(1-])-[%])/ ::_1:

Here is Wolfram Language ungolfing

If[IntegerQ@#,Range[#,#-m+1,-1],-1]&[n/m+(m-1)/2]

The answer for the number of coins the highest rank gnome is getting is simply N/M+(M-1)/2 (if it's an integer), we construct the negative of this (-:@(1-])-[%]). Then i: makes an array like that 2 1 0 _1 _2 for argument _2 and we take M elements from it.

#J - (削除) 32 (削除ここまで) (削除) 29 (削除ここまで) 28

(削除) Not (削除ここまで) shorter than other J solution, (削除) but (削除ここまで) and uses a different idea

(]{.[:i:-:@(1-])-[%])/ ::_1:

The answer for the number of coins the highest rank gnome is getting is simply N/M+(M-1)/2 (if it's an integer), we construct the negative of this (-:@(1-])-[%]). Then i: makes an array like that 2 1 0 _1 _2 for argument _2 and we take M elements from it.

added 13 characters in body
Source Link
swish
  • 7.8k
  • 3
  • 23
  • 30
Loading
added 94 characters in body
Source Link
swish
  • 7.8k
  • 3
  • 23
  • 30
Loading
deleted 12 characters in body
Source Link
swish
  • 7.8k
  • 3
  • 23
  • 30
Loading
added 3 characters in body
Source Link
swish
  • 7.8k
  • 3
  • 23
  • 30
Loading
Source Link
swish
  • 7.8k
  • 3
  • 23
  • 30
Loading

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