思路及代码
#include<iostream>
using namespace std;
int main(){
//input 多组
//input M,N int 1<= <=20
//input M 行 N 列 数据
//initialize list
int M, N;
while (cin >> M >> N){
int list[M][N];
for (int i = 0; i <= M-1; i++){
for (int j = 0; j <= N-1; j++){
cin >> list[i][j];
}
}
//solution
//遍历 i j output i+1,j+1
for (int i = 0; i <= M-1; i++){
for (int j = 0; j <= N-1; j++){
if (list[i][j] != 0){
cout << i+1 << ' ' << j+1 << ' ' << list[i][j] << endl;
}
}
}
cout << endl;
}
return 0;
}
参考:无
收获:无
菜菜,不是教程,做题和学习记录