Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
2
Task/McNuggets-problem/R/mcnuggets-problem-1.r
Normal file
2
Task/McNuggets-problem/R/mcnuggets-problem-1.r
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
allInputs <- expand.grid(x = 0:(100 %/% 6), y = 0:(100 %/% 9), z = 0:(100 %/% 20))
|
||||
mcNuggets <- do.call(function(x, y, z) 6 * x + 9 * y + 20 * z, allInputs)
|
||||
1
Task/McNuggets-problem/R/mcnuggets-problem-2.r
Normal file
1
Task/McNuggets-problem/R/mcnuggets-problem-2.r
Normal file
|
|
@ -0,0 +1 @@
|
|||
mcNuggets2 <- rowSums(expand.grid(seq(0, 100, 6), seq(0, 100, 9), seq(0, 100, 20)))
|
||||
1
Task/McNuggets-problem/R/mcnuggets-problem-3.r
Normal file
1
Task/McNuggets-problem/R/mcnuggets-problem-3.r
Normal file
|
|
@ -0,0 +1 @@
|
|||
all(mcNuggets == mcNuggets2)
|
||||
2
Task/McNuggets-problem/R/mcnuggets-problem-4.r
Normal file
2
Task/McNuggets-problem/R/mcnuggets-problem-4.r
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
results <- setdiff(0:100, mcNuggets)
|
||||
cat("The non-McNuggets numbers that are no greater than 100 are:", results, "\nThe largest is", max(results), "\n")
|
||||
1
Task/McNuggets-problem/R/mcnuggets-problem-5.r
Normal file
1
Task/McNuggets-problem/R/mcnuggets-problem-5.r
Normal file
|
|
@ -0,0 +1 @@
|
|||
max(setdiff(0:100, rowSums(expand.grid(seq(0, 100, 6), seq(0, 100, 9), seq(0, 100, 20)))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue