summaryrefslogtreecommitdiffstats
path: root/01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands
diff options
context:
space:
mode:
Diffstat (limited to '01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands')
-rw-r--r--01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/different_summands.cpp20
-rw-r--r--01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/tests/011
-rw-r--r--01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/tests/01.a2
-rw-r--r--01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/tests/021
-rw-r--r--01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/tests/02.a2
-rw-r--r--01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/tests/031
-rw-r--r--01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/tests/03.a2
7 files changed, 29 insertions, 0 deletions
diff --git a/01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/different_summands.cpp b/01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/different_summands.cpp
new file mode 100644
index 0000000..0f8b4cb
--- /dev/null
+++ b/01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/different_summands.cpp
@@ -0,0 +1,20 @@
+#include <iostream>
+#include <vector>
+
+using std::vector;
+
+vector<int> optimal_summands(int n) {
+ vector<int> summands;
+ //write your code here
+ return summands;
+}
+
+int main() {
+ int n;
+ std::cin >> n;
+ vector<int> summands = optimal_summands(n);
+ std::cout << summands.size() << '\n';
+ for (size_t i = 0; i < summands.size(); ++i) {
+ std::cout << summands[i] << ' ';
+ }
+}
diff --git a/01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/tests/01 b/01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/tests/01
new file mode 100644
index 0000000..1e8b314
--- /dev/null
+++ b/01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/tests/01
@@ -0,0 +1 @@
+6
diff --git a/01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/tests/01.a b/01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/tests/01.a
new file mode 100644
index 0000000..f3ce152
--- /dev/null
+++ b/01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/tests/01.a
@@ -0,0 +1,2 @@
+3
+1 2 3
diff --git a/01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/tests/02 b/01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/tests/02
new file mode 100644
index 0000000..45a4fb7
--- /dev/null
+++ b/01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/tests/02
@@ -0,0 +1 @@
+8
diff --git a/01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/tests/02.a b/01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/tests/02.a
new file mode 100644
index 0000000..175e44e
--- /dev/null
+++ b/01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/tests/02.a
@@ -0,0 +1,2 @@
+3
+1 2 5
diff --git a/01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/tests/03 b/01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/tests/03
new file mode 100644
index 0000000..0cfbf08
--- /dev/null
+++ b/01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/tests/03
@@ -0,0 +1 @@
+2
diff --git a/01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/tests/03.a b/01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/tests/03.a
new file mode 100644
index 0000000..db496fe
--- /dev/null
+++ b/01-algorithmic_toolbox/02-greedy_algorithms/05-different_summands/tests/03.a
@@ -0,0 +1,2 @@
+1
+2