summaryrefslogtreecommitdiffstats
path: root/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses
diff options
context:
space:
mode:
Diffstat (limited to '01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses')
-rw-r--r--01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/placing_parentheses.cpp32
-rw-r--r--01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/011
-rw-r--r--01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/01.a1
-rw-r--r--01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/021
-rw-r--r--01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/02.a1
5 files changed, 36 insertions, 0 deletions
diff --git a/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/placing_parentheses.cpp b/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/placing_parentheses.cpp
new file mode 100644
index 0000000..06861ab
--- /dev/null
+++ b/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/placing_parentheses.cpp
@@ -0,0 +1,32 @@
+#include <iostream>
+#include <cassert>
+#include <string>
+#include <vector>
+
+using std::vector;
+using std::string;
+using std::max;
+using std::min;
+
+long long eval(long long a, long long b, char op) {
+ if (op == '*') {
+ return a * b;
+ } else if (op == '+') {
+ return a + b;
+ } else if (op == '-') {
+ return a - b;
+ } else {
+ assert(0);
+ }
+}
+
+long long get_maximum_value(const string &exp) {
+ //write your code here
+ return 0;
+}
+
+int main() {
+ string s;
+ std::cin >> s;
+ std::cout << get_maximum_value(s) << '\n';
+}
diff --git a/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/01 b/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/01
new file mode 100644
index 0000000..cea3f71
--- /dev/null
+++ b/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/01
@@ -0,0 +1 @@
+1+5
diff --git a/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/01.a b/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/01.a
new file mode 100644
index 0000000..1e8b314
--- /dev/null
+++ b/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/01.a
@@ -0,0 +1 @@
+6
diff --git a/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/02 b/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/02
new file mode 100644
index 0000000..92a372d
--- /dev/null
+++ b/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/02
@@ -0,0 +1 @@
+5-8+7*4-8+9
diff --git a/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/02.a b/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/02.a
new file mode 100644
index 0000000..08839f6
--- /dev/null
+++ b/01-algorithmic_toolbox/04-dynamic_programming/04-placing_parentheses/tests/02.a
@@ -0,0 +1 @@
+200