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

MATL, (削除) 8 (削除ここまで) 6 bytes

yq^**s

Input is: array of exponents, number, array of coefficients.

Try it online! Or verify all test cases: 1, 2 3, 4, 5.

###Explanation

Explanation

Consider example inputs [3 4 10], 19, [4 -2 5].

y % Take first two inputs implicitly and duplicate the first
 % STACK: [3 4 10], 19, [3 4 10]
q % Subtract 1, element-wise
 % STACK: [3 4 10], 19, [2 3 9]
^ % Power, element-wise
 % STACK: [3 4 10], [361 6859 322687697779]
* % Multiply, element-wise
 % STACK: [1083 27436 3226876977790]
* % Take third input implicitly and multiply element-wise
 % STACK: [4332 -54872 16134384888950]
s % Sum of array
 % STACK: 16134384838410

MATL, (削除) 8 (削除ここまで) 6 bytes

yq^**s

Input is: array of exponents, number, array of coefficients.

Try it online! Or verify all test cases: 1, 2 3, 4, 5.

###Explanation

Consider example inputs [3 4 10], 19, [4 -2 5].

y % Take first two inputs implicitly and duplicate the first
 % STACK: [3 4 10], 19, [3 4 10]
q % Subtract 1, element-wise
 % STACK: [3 4 10], 19, [2 3 9]
^ % Power, element-wise
 % STACK: [3 4 10], [361 6859 322687697779]
* % Multiply, element-wise
 % STACK: [1083 27436 3226876977790]
* % Take third input implicitly and multiply element-wise
 % STACK: [4332 -54872 16134384888950]
s % Sum of array
 % STACK: 16134384838410

MATL, (削除) 8 (削除ここまで) 6 bytes

yq^**s

Input is: array of exponents, number, array of coefficients.

Try it online! Or verify all test cases: 1, 2 3, 4, 5.

Explanation

Consider example inputs [3 4 10], 19, [4 -2 5].

y % Take first two inputs implicitly and duplicate the first
 % STACK: [3 4 10], 19, [3 4 10]
q % Subtract 1, element-wise
 % STACK: [3 4 10], 19, [2 3 9]
^ % Power, element-wise
 % STACK: [3 4 10], [361 6859 322687697779]
* % Multiply, element-wise
 % STACK: [1083 27436 3226876977790]
* % Take third input implicitly and multiply element-wise
 % STACK: [4332 -54872 16134384888950]
s % Sum of array
 % STACK: 16134384838410
added 2 characters in body
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382

MATL, (削除) 8 (削除ここまで) 6 bytes

yq^**s

Input is: array of exponents, number, array of coefficients.

Try it online! Or verify all test cases: 1, 2 3, 4, 5.

###Explanation

Consider example inputs (outdated)[3 4 10], 19, [4 -2 5].

* y % Take first two inputs (arrays) implicitly. Multiplyand element-wiseduplicate the first
 i % STACK: [3 %4 Take10], third19, input[3 (number)4 10]
q 2G % Subtract 1, element-wise
 % Push second inputSTACK: again
[3 4 10], 19, q[2 3 9]
^ % SubtractPower, 1element-wise
 ^% STACK: [3 4 10], [361 6859 322687697779]
* % PowerMultiply, element-wise
 % STACK: [1083 27436 3226876977790]
* % Multiply,Take third input implicitly and multiply element-wise
 % STACK: [4332 -54872 16134384888950]
s % Sum of array. Implicitly display % STACK: 16134384838410

MATL, (削除) 8 (削除ここまで) 6 bytes

yq^**s

Input is: array of exponents, number, array of coefficients.

Try it online! Or verify all test cases: 1, 2 3, 4, 5.

###Explanation (outdated)

*  % Take first two inputs (arrays) implicitly. Multiply element-wise
 i % Take third input (number)
 2G % Push second input again
 q % Subtract 1
 ^ % Power, element-wise
 * % Multiply, element-wise
 s % Sum of array. Implicitly display

MATL, (削除) 8 (削除ここまで) 6 bytes

yq^**s

Input is: array of exponents, number, array of coefficients.

Try it online! Or verify all test cases: 1, 2 3, 4, 5.

###Explanation

Consider example inputs [3 4 10], 19, [4 -2 5].

y % Take first two inputs implicitly and duplicate the first
 % STACK: [3 4 10], 19, [3 4 10]
q % Subtract 1, element-wise
 % STACK: [3 4 10], 19, [2 3 9]
^ % Power, element-wise
 % STACK: [3 4 10], [361 6859 322687697779]
* % Multiply, element-wise
 % STACK: [1083 27436 3226876977790]
* % Take third input implicitly and multiply element-wise
 % STACK: [4332 -54872 16134384888950]
s % Sum of array  % STACK: 16134384838410
added 2 characters in body
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382

MATL, (削除) 8 (削除ここまで) 6 bytes

yq^**s

Input is: array of exponents, number, array of coefficients.

Try it online! Or verify all test cases: 1 1, 2 2 3 3, 4 4, 5 5.

###Explanation (outdated)

* % Take first two inputs (arrays) implicitly. Multiply element-wise
 i % Take third input (number)
 2G % Push second input again
 q % Subtract 1
 ^ % Power, element-wise
 * % Multiply, element-wise
 s % Sum of array. Implicitly display

MATL, (削除) 8 (削除ここまで) 6 bytes

yq^**s

Input is: array of exponents, number, array of coefficients.

Try it online! Or verify all test cases: 1, 2 3, 4, 5.

###Explanation (outdated)

* % Take first two inputs (arrays) implicitly. Multiply element-wise
 i % Take third input (number)
 2G % Push second input again
 q % Subtract 1
 ^ % Power, element-wise
 * % Multiply, element-wise
 s % Sum of array. Implicitly display

MATL, (削除) 8 (削除ここまで) 6 bytes

yq^**s

Input is: array of exponents, number, array of coefficients.

Try it online! Or verify all test cases: 1, 2 3, 4, 5.

###Explanation (outdated)

* % Take first two inputs (arrays) implicitly. Multiply element-wise
 i % Take third input (number)
 2G % Push second input again
 q % Subtract 1
 ^ % Power, element-wise
 * % Multiply, element-wise
 s % Sum of array. Implicitly display
added 2 characters in body
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382
Loading
added 431 characters in body
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382
Loading
Post Undeleted by Luis Mendo
Post Deleted by Luis Mendo
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382
Loading

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