Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commit0320df7a3aed3024a60165a7822522dc863efe0d (patch)
Author
 Syndamia <kamen@syndamia.com>
2023-04-05 10:14:09 +0300
Committer
 Syndamia <kamen@syndamia.com>
2023-04-05 10:14:09 +0300
Files27d97f4dccaad127fede3b87eadc4edbde3c35cc
uni-projects-0320df7a3aed3024a60165a7822522dc863efe0d.tar
uni-projects-0320df7a3aed3024a60165a7822522dc863efe0d.tar.gz
uni-projects-0320df7a3aed3024a60165a7822522dc863efe0d.zip
Parentbf342b5369bb9eaf86827cd8a64fc965705d64fe (diff)
[DAAP] Solved arena exercise
1 files changed, 35 insertions, 0 deletions
-rw-r--r--Year 2/Design and analysis of algorithms/Practicum/Arena-119.cpp35
diff --git a/Year 2/Design and analysis of algorithms/Practicum/Arena-119.cpp b/Year 2/Design and analysis of algorithms/Practicum/Arena-119.cpp
new file mode 100644
index 0000000..5f3c9da
--- /dev/null
+++ b/Year 2/Design and analysis of algorithms/Practicum/Arena-119.cpp
@@ -0,0 +1,35 @@
+#include <algorithm>
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+int letters[100] = { 0 };
+
+int main() {
+ string input;
+ getline(cin, input);
+
+ string cap = "BAZINGA", low = "bazinga";
+ for (char c : input) {
+ for (int i = 0; i < cap.size(); i++) {
+ if (c == cap[i] || c == low[i]) {
+ letters[i]++;
+ break;
+ }
+ }
+ }
+ letters[6] = letters[1] = letters[1] / 2;
+
+ int minV = letters[0];
+ for (int i = 0; i < cap.size(); i++) {
+ if (letters[i] == 0) {
+ minV = 0;
+ break;
+ }
+ minV = min(minV, letters[i]);
+ }
+
+ cout << minV << endl;
+ return 0;
+}