|
|
back to boardC++ Accepted 0.001 Posted by Trest 1 Aug 2021 22:13 #include <iostream> #include <vector> #include <iterator> int main() { int N; std::cin >> N; char v; int h, c = 0; std::vector<int> result; while (N--) { std::cin >> v >> h; v = v - 'a' + 1; if (h > 1 && v > 2) c += 1; if (h > 1 && v < 7) c += 1; if (h > 2 && v > 1) c += 1; if (h > 2 && v < 8) c += 1; if (h < 8 && v > 2) c += 1; if (h < 8 && v < 7) c += 1; if (h < 7 && v > 1) c += 1; if (h < 7 && v < 8) c += 1; result.push_back(c); c = 0; } std::copy(result.begin(), result.end(), std::ostream_iterator<int>(std::cout, "\n")); return 0; } |
|
|