File tree 5 files changed +56
-0
lines changed
5 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 16
16
| 01 | | [ Codility-Lesson1 BinaryGap] ( ./src/Iterations/BinaryGap ) | |
17
17
| 02 | | [ SWEA-1289 ์์ฌ์ ๋ฉ๋ชจ๋ฆฌ ๋ณต๊ตฌํ๊ธฐ] ( ./src/Iterations/swea1289 ) | |
18
18
| 03 | | [ SWEA-3499 ํผํํธ ์
ํ] ( ./src/Iterations/swea3499 ) | |
19
+ | 04 | | [ SWEA-7964 ๋ถ๋จน์๊ตญ์ ์ฐจ์ ๊ด๋ฌธ] ( ./src/Iterations/swea7964 ) | |
19
20
20
21
## Recursion
21
22
Original file line number Diff line number Diff line change
1
+ ## [ SW Expert Academy - 7964] ๋ถ๋จน์๊ตญ์ ์ฐจ์ ๊ด๋ฌธ
2
+
3
+ ![ image] ( https://user-images.githubusercontent.com/22045163/109156080-c8675a80-77b3-11eb-8cd3-b342cc682bb5.png )
4
+ ![ image] ( https://user-images.githubusercontent.com/22045163/109156125-d1f0c280-77b3-11eb-8ab6-e0078da11284.png )
5
+
6
+ ![ image] ( https://user-images.githubusercontent.com/22045163/109156160-dcab5780-77b3-11eb-9ca6-c9d83bad3ca1.png )
Original file line number Diff line number Diff line change
1
+ package Iterations .swea7964 ;
2
+
3
+ import java .io .BufferedReader ;
4
+ import java .io .FileInputStream ;
5
+ import java .io .InputStreamReader ;
6
+ import java .util .StringTokenizer ;
7
+
8
+ public class Solution {
9
+
10
+ static int T , N , D , C ;
11
+
12
+ public static void main (String [] args ) throws Exception {
13
+ System .setIn (new FileInputStream ("src/Iterations/swea7964/input.txt" ));
14
+ BufferedReader br = new BufferedReader (new InputStreamReader (System .in ));
15
+ StringBuilder sb = new StringBuilder ();
16
+
17
+ T = Integer .parseInt (br .readLine ());
18
+ for (int t = 1 ; t <= T ; t ++) {
19
+ StringTokenizer st = new StringTokenizer (br .readLine ());
20
+ N = Integer .parseInt (st .nextToken ());
21
+ D = Integer .parseInt (st .nextToken ());
22
+
23
+ int cnt = 0 , dist = 0 ;
24
+ st = new StringTokenizer (br .readLine ());
25
+ for (int i = 1 ; i <= N ; i ++) {
26
+ C = Integer .parseInt (st .nextToken ());
27
+ if (C == 1 ) {
28
+ dist = 0 ;
29
+ } else {
30
+ dist ++;
31
+ if (dist == D ) { cnt ++; dist = 0 ; }
32
+ }
33
+ }
34
+
35
+ sb .append ("#" ).append (t ).append (" " ).append (cnt ).append ("\n " );
36
+ }
37
+ System .out .println (sb .toString ());
38
+ }
39
+ }
Original file line number Diff line number Diff line change
1
+ 3
2
+ 6 2
3
+ 1 0 0 0 0 1
4
+ 10 2
5
+ 0 0 1 0 1 0 0 0 0 1
6
+ 10 1
7
+ 0 0 0 0 0 0 0 0 0 0
Original file line number Diff line number Diff line change
1
+ #1 2
2
+ #2 3
3
+ #3 10
You canโt perform that action at this time.
0 commit comments