summaryrefslogtreecommitdiff
path: root/1_anno/Programmazione_1/ex2_27_01_20.cc
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2021-02-06 19:56:36 +0100
committerSanto Cariotti <santo@dcariotti.me>2021-02-06 19:56:36 +0100
commitd2edbc38cac8da52f58c5cd3da6c0c625fa05736 (patch)
treea51e9a4e56fc9d4c7c9e37576dceedca3a0c72b4 /1_anno/Programmazione_1/ex2_27_01_20.cc
parent98f34040820dc3a964b7be59a698323e8cc6c8a3 (diff)
conf: rename
Diffstat (limited to '1_anno/Programmazione_1/ex2_27_01_20.cc')
-rw-r--r--1_anno/Programmazione_1/ex2_27_01_20.cc57
1 files changed, 0 insertions, 57 deletions
diff --git a/1_anno/Programmazione_1/ex2_27_01_20.cc b/1_anno/Programmazione_1/ex2_27_01_20.cc
deleted file mode 100644
index 25caf5b..0000000
--- a/1_anno/Programmazione_1/ex2_27_01_20.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-#include<iostream>
-#include<set>
-
-using namespace std;
-
-template<int N, int M>
-double func(string (&A)[N][M], string x, string y, short k, short w) {
- set<char> s;
- for(char const&c : x) s.insert(c);
- x = "";
- for(char const&c: s) x+=c;
-
- s.clear();
- for(char const&c : y) s.insert(c);
- y = "";
- for(char const&c: s) y+=c;
-
- for(int i = 0; i < N; ++i) {
- for(int j = 0; j < M; ++j) {
- s.clear();
- for(char const&c : A[i][j]) s.insert(c);
- A[i][j] = "";
- for(char const&c: s) A[i][j]+=c;
- }
- }
-
- short counter{};
- for(int i = 0; i < M; ++i) {
- short k_i{};
- for(int j = 0; j < N; ++j) {
- if(A[j][i].length() < w) continue;
- short char_counter{};
- for(char const& c: A[j][i]) {
- if(x.find(c) != std::string::npos && y.find(c) != std::string::npos)
- ++char_counter;
- }
- if(char_counter >= w)
- ++k_i;
- }
- if(k_i >= k)
- ++counter;
- }
-
- return static_cast<double>(counter*100)/static_cast<double>(M);
-}
-
-int main() {
- string A[3][4] = {
- {"we,", "heila", "ciaone", ""},
- {"we,", "heila", "ciaone", ""},
- {"we,", "heila", "ciaone", ""},
- };
-
- cout << func(A, "we", "we", 2, 2);
-
- return 0;
-}