题解 | 单组_二维数组

单组_二维数组

https://www.nowcoder.com/practice/4df606b6c3764d9c969f8759c8a4807b

#include <stdio.h>
#if 0
int main() {
    int a, b;
    while (scanf("%d %d", &a, &b) != EOF) { // 注意 while 处理多个 case
        // 64 位输出请用 printf("%lld") to
        printf("%d\n", a + b);
    }
    return 0;
}
#endif

int main() {
    int a, b;
    scanf("%d %d", &a, &b);
   long sz[a][b];
    int i,j;
    long sum =0;
    for (i=0;i<a;i++){
        for(j=0;j<b;j++)
        {
            scanf("%ld", &sz[i][j]);
            sum += sz[i][j];
        }      

    }

    printf("%ld", sum);

    return 0;
}

全部评论
11
点赞 回复 分享
发布于 03-18 13:07 浙江

相关推荐

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

创作者周榜

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