fork download
  1. p <- c(460, 580, 600)
  2. n <- 10
  3. s <- 5360
  4. N <- as.matrix(expand.grid(1:n, 1:n, 1:n))
  5. M <- N[rowSums(N) == n & N %*%p == s, , drop = FALSE]
  6. apply(M, 1, function(v) cat(toString(sprintf("%d円×%d", p, v)), "\n", sep = "")) -> .
Success #stdin #stdout 0.28s 43528KB
stdin
Standard input is empty
stdout
460円×4, 580円×4, 600円×2