File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ //https://www.acmicpc.net/problem/29700
2+ import java .io .BufferedReader ;
3+ import java .io .IOException ;
4+ import java .io .InputStreamReader ;
5+ import java .util .StringTokenizer ;
6+
7+ public class BOJ_S4_29700_우당탕탕영화예매 {
8+ public static void main (String [] args ) throws IOException {
9+ BufferedReader br = new BufferedReader (new InputStreamReader (System .in ));
10+ StringTokenizer st = new StringTokenizer (br .readLine ());
11+
12+ int N = Integer .parseInt (st .nextToken ());
13+ int M = Integer .parseInt (st .nextToken ());
14+ int K = Integer .parseInt (st .nextToken ());
15+
16+ int [][] sum = new int [N ][M +1 ];
17+
18+ for (int i = 0 ; i < N ; i ++) {
19+ String s = br .readLine ();
20+ for (int j = 0 ; j < M ; j ++) {
21+ int n = s .charAt (j ) - '0' ;
22+ sum [i ][j +1 ] = sum [i ][j ] + n ;
23+ }
24+ }
25+
26+ int cnt = 0 ;
27+
28+ for (int i = 0 ; i < N ; i ++) {
29+ for (int j = K ; j <= M ; j ++) {
30+ int diff = sum [i ][j ] - sum [i ][j -K ];
31+
32+ if (diff == 0 ) cnt ++;
33+ }
34+ }
35+
36+ System .out .println (cnt );
37+
38+ }
39+ }
You can’t perform that action at this time.
0 commit comments