More actions
imported>skywave No edit summary |
imported>skywave No edit summary |
||
| Line 3: | Line 3: | ||
== 풀이 == | == 풀이 == | ||
=== 조영준 === | === 조영준 === | ||
주어진 Test Case로만 테스트를 진행하였습니다. | |||
import java.util.Scanner; | import java.util.Scanner; | ||
| Line 27: | Line 28: | ||
columnSum[k] += columnCost[k]; | columnSum[k] += columnCost[k]; | ||
} | } | ||
} | } | ||
} | } | ||
| Line 38: | Line 38: | ||
System.out.println(caseSum); | System.out.println(caseSum); | ||
} | } | ||
scanner.close(); | scanner.close(); | ||
} | } | ||
} | } | ||
Latest revision as of 11:23, 16 August 2014
풀이
조영준
주어진 Test Case로만 테스트를 진행하였습니다.
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();
}
}