公式
B - 宝物の地図 / Treasure Map 解説
by
B - 宝物の地図 / Treasure Map 解説
by
kyopro_friends
問題文の指示通り、各 \(S_i\) が o を含むかどうかを調べればよいです。
実装例 (C++)
#include<bits/stdc++.h>
using namespace std;
int main(){
int h, w;
cin >> h >> w;
vector<string> s(h);
for(int i=0; i<h; i++) cin >> s[i];
for(int i=0; i<h; i++){
if(s[i].find('T')!=-1){
cout << 'o';
}else{
cout << 'x';
}
}
}
実装例 (Python)
H, W = map(int, input().split())
S = [input() for _ in range(H)]
for s in S:
if "T" in s:
print("o", end="")
else:
print("x", end="")
