Difference between r1.1 and the current
@@ -2,6 +2,7 @@
== 풀이 ==
=== 조영준 ===
주어진 Test Case로만 테스트를 진행하였습니다.
{{{import java.util.Scanner;
@@ -27,7 +28,6 @@
} else {
columnSum[k] += columnCost[k];
}
}
}
columnSum[k] += columnCost[k];
}
}
@@ -39,9 +39,7 @@
System.out.println(caseSum);
}
scanner.close();
}
}
}}}
}
}
}}}
풀이 ¶
조영준 ¶
주어진 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(); } }