Skip to main content
added 118 characters in body
Source Link
M L
  • 3.3k
  • 1
  • 19
  • 19

Julia, 4848 35 characters

function p(m);sum([2 3 4 1].*m)+10minimum(m);end

in compact assignment form:

function p(m);sum=sum([2 3 4 1].*m)+10minimum(m);end

Example:

julia> p([3 5 4 3])
70

Julia, 48 characters

function p(m);sum([2 3 4 1].*m)+10minimum(m);end

Example:

julia> p([3 5 4 3])
70

Julia, 48 35 characters

function p(m);sum([2 3 4 1].*m)+10minimum(m);end

in compact assignment form:

p(m)=sum([2 3 4 1].*m)+10minimum(m)

Example:

julia> p([3 5 4 3])
70
Source Link
M L
  • 3.3k
  • 1
  • 19
  • 19

Julia, 48 characters

function p(m);sum([2 3 4 1].*m)+10minimum(m);end

Example:

julia> p([3 5 4 3])
70