Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- #include <fstream>
- const int FIELD_SIZE = 16;
- int main() {
- std::ifstream fin("input.txt");
- int count, result = 0;
- fin >> count;
- count *= 2;
- char ch;
- std::vector<int> vec(9);
- for (int i = 0; i < FIELD_SIZE; i++) {
- fin >> ch;
- if (ch != '.') {
- vec[ch - '1']++;
- }
- }
- for (int i = 0; i < 9; i++) {
- if (vec[i] > 0 && vec[i] <= count) {
- result++;
- }
- }
- std::cout << result;
- }
Advertisement
Add Comment
Please, Sign In to add comment