Untitled
unknown
c_cpp
2 years ago
490 B
7
Indexable
#include <iostream>
using namespace std;
int main() {
int n_grid, h_sells, max_sells,status;
h_sells = 10;
max_sells = h_sells * h_sells;
cin >> n_grid;
for (int grid = 0; grid < n_grid; grid++) {
int pos_x = 1, pos_y = 1;
for (int cell = 1; cell <= max_sells; cell++) {
cin >> status;
if (status == 1) {
cout << pos_y << " " << pos_x;
}
pos_x += 1;
if (pos_x > h_sells) {
pos_x -= h_sells;
pos_y += 1;
}
}
}
}Editor is loading...