T427570 【小任务】行列转换
This commit is contained in:
@@ -1,13 +1,18 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
int x[10][10], n, m, k, a, b, c;
|
||||||
|
int main() {
|
||||||
struct Node{
|
cin >> n >> m >> k;
|
||||||
int first;
|
for (int i = 0; i < k; i++) {
|
||||||
int second;
|
cin >> a >> b >> c;
|
||||||
};
|
x[a][b] = c; // 行优先
|
||||||
|
}
|
||||||
|
for (int i = 1; i <= m; i++) { // 列优先(i=列,j=行)
|
||||||
int main(){
|
for (int j = 1; j <= n; j++) {
|
||||||
|
if (x[j][i] != 0) { // j=行 ,i=列
|
||||||
|
cout << x[j][i] << " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user