Official
B - Chessboard Editorial by en_translator
Locate the square with *
and find its name. Note whether the index corresponds to vertical or horizontal axis, whether it increases upwards or downwards, and whether the index of arrays and strings starts from \(0\) or \(1\), when implementing.
#include<bits/stdc++.h>
using namespace std;
int main(){
vector<string>s(8);
for(int i=0;i<8;i++)cin >> s[i];
for(int i=0;i<8;i++)for(int j=0;j<8;j++){
if(s[i][j]=='*'){
cout << "abcdefgh"[j] << 8-i << endl;
return 0;
}
}
}
S=[input() for _ in range(8)]
for i in range(8):
for j in range(8):
if S[i][j]=='*':
print(f"{'abcdefgh'[j]}{8-i}")
exit()
posted:
last update: