Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions Katas/CP/team/src/solution.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include <bits/stdc++.h>
#include <iostream>
#include <sstream>
int getKnowingProblems(int *problems, int n) {
int count_knowing_problems = 0;
for (int i = 0; i < n; i++) {
if (problems[i] >= 2) {
count_knowing_problems++;
}
}
return count_knowing_problems;
}

int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
int n;
std::cin >> n;
std::string problem;
int problems[n];
std::cin.ignore();
int total = 0;
int num;
for (int i = 0; i < n; i++) {
getline(std::cin, problem);
std::stringstream ss(problem);
while (ss >> num) {
total += num;
}
problems[i] = total;
total = 0;
}

int result = getKnowingProblems(problems, n);
std::cout << result << "\n";
return 0;
}
1 change: 1 addition & 0 deletions Katas/CP/team/test/expected1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2
1 change: 1 addition & 0 deletions Katas/CP/team/test/expected2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
4 changes: 4 additions & 0 deletions Katas/CP/team/test/input1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
3
1 1 0
1 1 1
1 0 0
6 changes: 6 additions & 0 deletions Katas/CP/team/test/input2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
5
1 0 0
0 1 0
1 1 1
0 0 1
0 0 0
Loading