Untitled
user_7227489
plain_text
a month ago
1.1 kB
5
Indexable
Never
#include <iostream> #include <vector> #include <algorithm> using namespace std; signed main() { int len, k; cin >> len >> k; int width = 5; for (int i = 1; i <= len; i++) { width--; if (width == -1) width = 4; for (int j = 1 + width; j <= len; j += 5) { cout << i << ' ' << j << endl; string s; cin >> s; if (s == "hit") { for ( k = 1 + j; k <= len && k <= j + 4; k++) { std::cout << i << ' ' << k << endl; std::cin >> s; } for ( k = j - 1; k >= 1 && k >= j - 4; k--) { cout << i << ' ' << k << endl; cin >> s; } for ( k = 1 + i; k <= len && k <= i + 4; k++) { cout << k << ' ' << j << endl; cin >> s; } for ( k = i - 1; k >= 1 && k >= i - 4; k--) { cout << k << ' ' << j << endl; cin >> s; } } } } }
Leave a Comment