2 deleted 389 characters in body
source | link

R, 8888 83 bytes

-5 bytes thanks to @Jarko Dubbeldam

returns an anonymous function. It generates all the possible combinations of coins (using expand.grid on pairs of T,F) and checks if the value(s) are present. k is coins since c is a reserved word in R. Can check multiple values at once.

function(k,v)v%in%apply(expand.grid(rep(list(c(T,F)),lengthMap(k))),1,function(x)sum(k[x]))

Try it online!

stdin version (92 bytes): takes value(s), then coin values.

v=scan();v%in%apply(expand.grid(rep(list(c(T,F))!0:1,length(k<-scan())k)),1,function(x)sum(k[x]))

Try stdin version online!Try it online!

R, 88 bytes

returns an anonymous function. It generates all the possible combinations of coins (using expand.grid on pairs of T,F) and checks if the value(s) are present. k is coins since c is a reserved word in R. Can check multiple values at once.

function(k,v)v%in%apply(expand.grid(rep(list(c(T,F)),length(k))),1,function(x)sum(k[x]))

Try it online!

stdin version (92 bytes): takes value(s), then coin values.

v=scan();v%in%apply(expand.grid(rep(list(c(T,F)),length(k<-scan()))),1,function(x)sum(k[x]))

Try stdin version online!

R, 88 83 bytes

-5 bytes thanks to @Jarko Dubbeldam

returns an anonymous function. It generates all the possible combinations of coins (using expand.grid on pairs of T,F) and checks if the value(s) are present. k is coins since c is a reserved word in R. Can check multiple values at once.

function(k,v)v%in%apply(expand.grid(Map(function(x)!0:1,k)),1,function(x)sum(k[x]))

Try it online!

1
source | link

R, 88 bytes

returns an anonymous function. It generates all the possible combinations of coins (using expand.grid on pairs of T,F) and checks if the value(s) are present. k is coins since c is a reserved word in R. Can check multiple values at once.

function(k,v)v%in%apply(expand.grid(rep(list(c(T,F)),length(k))),1,function(x)sum(k[x]))

Try it online!

stdin version (92 bytes): takes value(s), then coin values.

v=scan();v%in%apply(expand.grid(rep(list(c(T,F)),length(k<-scan()))),1,function(x)sum(k[x]))

Try stdin version online!