https://icpcarchive.ecs.baylor.edu/external/65/6500.pdf == 풀이 == === 조영준 === {{{ import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int caseSize = scanner.nextInt(); for (int i = 0; i < caseSize; i++) { int caseHeight = scanner.nextInt(); int caseWidth = scanner.nextInt(); int[] columnCost = new int[caseWidth]; int[] columnSum = new int[caseWidth]; for (int j = 0; j < caseHeight; j++) { for (int k = 0; k < caseWidth; k++) { int currentBox = scanner.nextInt(); if (currentBox == 1) { columnCost[k]++; } else { columnSum[k] += columnCost[k]; } } } int caseSum = 0; for (int j = 0; j < caseWidth; j++) { caseSum += columnSum[j]; } System.out.println(caseSum); } scanner.close(); } } }}}