解法:
#include<iostream>
using namespace std;
int arr[100][100];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cin >> arr[i][j];
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (arr[i][j]) cout << j;
}
cout << endl;
}
return 0;
}