题解 | #矩阵元素定位#

矩阵元素定位

https://www.nowcoder.com/practice/b8e6a46992fe4e11b2822b20561b6d94

#include <stdio.h>
#include <stdlib.h>
int main() {
    int a,b;
    while (scanf("%d %d", &a, &b) != EOF) { // 注意 while 处理多个 case
        int** r=(int**)malloc(sizeof(int*)*a);
        for(int i=0;i<a;i++)
        {
            r[i]=(int*)malloc(sizeof(int)*b);
            for(int j=0;j<b;j++)
            {
                scanf("%d",&r[i][j]);
            }
           // getchar();
        }
        scanf("%d %d",&a,&b);
        printf("%d",r[a-1][b-1]);

        free(r);
    }
    return 0;
}

#基础练习#
全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务