From 78ad8ad974b7aebe1a3bea798ac8a59e6f7ad2e3 Mon Sep 17 00:00:00 2001 From: leo12025 Date: Thu, 31 Jul 2025 18:58:12 +0800 Subject: [PATCH] =?UTF-8?q?T427570=20=E3=80=90=E5=B0=8F=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E3=80=91=E8=A1=8C=E5=88=97=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test01/main.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/test01/main.cpp b/test01/main.cpp index 1e88f40..e045a57 100644 --- a/test01/main.cpp +++ b/test01/main.cpp @@ -1,13 +1,18 @@ #include using namespace std; - - -struct Node{ - int first; - int second; -}; - - -int main(){ - +int x[10][10], n, m, k, a, b, c; +int main() { + cin >> n >> m >> k; + for (int i = 0; i < k; i++) { + cin >> a >> b >> c; + x[a][b] = c; // 行优先 + } + for (int i = 1; i <= m; i++) { // 列优先(i=列,j=行) + for (int j = 1; j <= n; j++) { + if (x[j][i] != 0) { // j=行 ,i=列 + cout << x[j][i] << " "; + } + } + } + return 0; }