#26058: 哪錯?

#### a979343838@gmail.com (Jeff2015 Lin)

School : No School
ID : 93079
2021-08-10 11:15:22
a015. 矩陣的翻轉 | From: [220.142.172.77] | Post Date : 2021-07-14 18:02

int main()

{

int i,j,a,b;

scanf("%d %d",&i,&j);

int g1[i][j],g2[j][i];

for(a=0;a<i;a++){

for(b=0;b<j;b++){

scanf("%d",&g1[a][b]);

}

}

for( a=0;a<i;a++){

for(b=0;b<j;b++){

g2[b][a]=g1[a][b];

}

}

for(int a=0;a<j;a++){

for(b=0;b<i;b++){

printf("%d ",g2[a][b]);

}

if(a!=j-1 && b!=i-1){

printf("\n");

}

}

return 0;

}

#26063: Re:哪錯?

#### 0520ryanyu (余秉侖)

School : 國立科學工業園區實驗高級中學
ID : 122637
2021-12-07 14:34:38
a015. 矩陣的翻轉 | From: [60.251.194.164] | Post Date : 2021-07-14 20:34

int main()

{

int i,j,a,b;

scanf("%d %d",&i,&j);

int g1[i][j],g2[j][i];

for(a=0;a<i;a++){

for(b=0;b<j;b++){

scanf("%d",&g1[a][b]);

}

}

for( a=0;a<i;a++){

for(b=0;b<j;b++){

g2[b][a]=g1[a][b];

}

}

for(int a=0;a<j;a++){

for(b=0;b<i;b++){

printf("%d ",g2[a][b]);

}

if(a!=j-1 && b!=i-1){

printf("\n");

}

}

return 0;

}