题解 | 多组_二维数组_T组形式

public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int q = sc.nextInt();

        for (int i = 0; i < q; i++) {

            int m = sc.nextInt();

            int c = sc.nextInt();//二维数组嵌套循环多麻烦

            long sum = 0;

            for (int i1 = 0; i1 < m*c; i1++) {//求和嘛,就这么多个

                    int n = sc.nextInt();

                    sum += n;

            }

        System.out.println(sum);

        }

    }

全部评论

相关推荐

狸猫换offer:神通广大的互联网
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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