[Ðü+NÌ/‚ζ˜ʒ.ï}DŠQ#
オンラインでお試しください!
ええ、間違いなくハードコアを改善できます。リファクタリングに取り組んでいます。
おそらく私が得ているのと同じくらい良い。
-1ありがとう、エミグナ!スワップを指摘するために、レジスタよりもうまく機能しました。
[ // Infinite loop.
Ð // Triplicate [p, ..., q]
U // Pop 1 of 3 copies into register X.
ü+ // Pairwise addition.
NÌ/ // Divide by current iteration + 2 (which is d).
‚ // Group original [p, ..., q] with pairwise additives.
ζ˜ // Transpose together and flatten.
ʒ.ï} // Filter out non-integer entities (includes the space added by zip).
DXQ // Dupe result, see if equal to original.
# // If new array is original array, nothing happened, quit & return.
デバッグダンプ[p,q] = [1,3]
:
Full program: [ÐUü+NÌ/‚ζ˜ʒ.ï}DXQ#
current >> [ || stack: []
ÐUü+NÌ/‚ζ˜ʒ.ï}DXQ#
Full program: ÐUü+NÌ/‚ζ˜ʒ.ï}DXQ#
current >> Ð || stack: []
current >> U || stack: [[1, 3], [1, 3], [1, 3]]
current >> ü || stack: [[1, 3], [1, 3]]
Full program: +
current >> + || stack: [1, 3]
stack > [4]
current >> N || stack: [[1, 3], [4]]
current >> Ì || stack: [[1, 3], [4], 0]
current >> / || stack: [[1, 3], [4], 2]
current >> ‚ || stack: [[1, 3], [2.0]]
current >> ζ || stack: [[[1, 3], [2.0]]]
current >> ˜ || stack: [[[1, 2.0], [3, ' ']]]
current >> ʒ || stack: [[1, 2.0, 3, ' ']]
Filter: .ï
Full program: .ï
current >> . || stack: [1]
stack > [1]
Full program: .ï
current >> . || stack: [2.0]
stack > [1]
Full program: .ï
current >> . || stack: [3]
stack > [1]
Full program: .ï
current >> . || stack: [' ']
invalid literal for int() with base 10: ' '
stack > []
current >> D || stack: [[1, 2.0, 3]]
current >> X || stack: [[1, 2.0, 3], [1, 2.0, 3]]
current >> Q || stack: [[1, 2.0, 3], [1, 2.0, 3], [1, 3]]
current >> # || stack: [[1, 2.0, 3], 0]
stack > [[1, 2.0, 3]]
Full program: ÐUü+NÌ/‚ζ˜ʒ.ï}DXQ#
current >> Ð || stack: [[1, 2.0, 3]]
current >> U || stack: [[1, 2.0, 3], [1, 2.0, 3], [1, 2.0, 3]]
current >> ü || stack: [[1, 2.0, 3], [1, 2.0, 3]]
Full program: +
current >> + || stack: [1, 2.0]
stack > [3.0]
Full program: +
current >> + || stack: [3.0, 2.0, 3]
stack > [3.0, 5.0]
current >> N || stack: [[1, 2.0, 3], [3.0, 5.0]]
current >> Ì || stack: [[1, 2.0, 3], [3.0, 5.0], 1]
current >> / || stack: [[1, 2.0, 3], [3.0, 5.0], 3]
current >> ‚ || stack: [[1, 2.0, 3], [1.0, 1.6666666666666667]]
current >> ζ || stack: [[[1, 2.0, 3], [1.0, 1.6666666666666667]]]
current >> ˜ || stack: [[[1, 1.0], [2.0, 1.6666666666666667], [3, ' ']]]
current >> ʒ || stack: [[1, 1.0, 2.0, 1.6666666666666667, 3, ' ']]
Filter: .ï
Full program: .ï
current >> . || stack: [1]
stack > [1]
Full program: .ï
current >> . || stack: [1.0]
stack > [1]
Full program: .ï
current >> . || stack: [2.0]
stack > [1]
Full program: .ï
current >> . || stack: [1.6666666666666667]
stack > [0]
Full program: .ï
current >> . || stack: [3]
stack > [1]
Full program: .ï
current >> . || stack: [' ']
invalid literal for int() with base 10: ' '
stack > []
current >> D || stack: [[1, 1.0, 2.0, 3]]
current >> X || stack: [[1, 1.0, 2.0, 3], [1, 1.0, 2.0, 3]]
current >> Q || stack: [[1, 1.0, 2.0, 3], [1, 1.0, 2.0, 3], [1, 2.0, 3]]
current >> # || stack: [[1, 1.0, 2.0, 3], 0]
stack > [[1, 1.0, 2.0, 3]]
Full program: ÐUü+NÌ/‚ζ˜ʒ.ï}DXQ#
current >> Ð || stack: [[1, 1.0, 2.0, 3]]
current >> U || stack: [[1, 1.0, 2.0, 3], [1, 1.0, 2.0, 3], [1, 1.0, 2.0, 3]]
current >> ü || stack: [[1, 1.0, 2.0, 3], [1, 1.0, 2.0, 3]]
Full program: +
current >> + || stack: [1, 1.0]
stack > [2.0]
Full program: +
current >> + || stack: [2.0, 1.0, 2.0]
stack > [2.0, 3.0]
Full program: +
current >> + || stack: [2.0, 3.0, 2.0, 3]
stack > [2.0, 3.0, 5.0]
current >> N || stack: [[1, 1.0, 2.0, 3], [2.0, 3.0, 5.0]]
current >> Ì || stack: [[1, 1.0, 2.0, 3], [2.0, 3.0, 5.0], 2]
current >> / || stack: [[1, 1.0, 2.0, 3], [2.0, 3.0, 5.0], 4]
current >> ‚ || stack: [[1, 1.0, 2.0, 3], [0.5, 0.75, 1.25]]
current >> ζ || stack: [[[1, 1.0, 2.0, 3], [0.5, 0.75, 1.25]]]
current >> ˜ || stack: [[[1, 0.5], [1.0, 0.75], [2.0, 1.25], [3, ' ']]]
current >> ʒ || stack: [[1, 0.5, 1.0, 0.75, 2.0, 1.25, 3, ' ']]
Filter: .ï
Full program: .ï
current >> . || stack: [1]
stack > [1]
Full program: .ï
current >> . || stack: [0.5]
stack > [0]
Full program: .ï
current >> . || stack: [1.0]
stack > [1]
Full program: .ï
current >> . || stack: [0.75]
stack > [0]
Full program: .ï
current >> . || stack: [2.0]
stack > [1]
Full program: .ï
current >> . || stack: [1.25]
stack > [0]
Full program: .ï
current >> . || stack: [3]
stack > [1]
Full program: .ï
current >> . || stack: [' ']
invalid literal for int() with base 10: ' '
stack > []
current >> D || stack: [[1, 1.0, 2.0, 3]]
current >> X || stack: [[1, 1.0, 2.0, 3], [1, 1.0, 2.0, 3]]
current >> Q || stack: [[1, 1.0, 2.0, 3], [1, 1.0, 2.0, 3], [1, 1.0, 2.0, 3]]
current >> # || stack: [[1, 1.0, 2.0, 3], 1]
[1, 1.0, 2.0, 3]
stack > [[1, 1.0, 2.0, 3]]
デバッグしてオンラインで試してください!
ü
...これは私が私の前の回答:-)の一つ改善するために作品を許可