解法:
cpp
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int arr[100][100];
int main() {
int n;
cin >> n;
getchar();
vector<string> s(n);
for (int i = 0; i < n; i++) {
getline(cin, s[i]);
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < s[i].size(); j++) {
if (s[i][j] >= '0' && s[i][j] <= '9') {
arr[i][s[i][j]-'0'] = 1;
}
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cout << arr[i][j];
}
cout << endl;
}
return 0;
}