diff --git a/yuna83/README.md b/yuna83/README.md index c77b7df2..e3adb3d6 100644 --- a/yuna83/README.md +++ b/yuna83/README.md @@ -30,4 +30,5 @@ | 26차시 | 2024.01.30 | 딕셔너리 | [귤 고르기](https://school.programmers.co.kr/learn/courses/30/lessons/138476)|https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/125| | 27차시 | 2024.02.05 | 투포인터 | [좋다](https://www.acmicpc.net/problem/1253)|https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/129| | 28차시 | 2024.02.07 | 투포인터 | [구명보트](https://school.programmers.co.kr/learn/courses/30/lessons/42885)|https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/134| +| 29차시 | 2024.02.13 | 슬라이딩윈도우 | [블로그](https://www.acmicpc.net/problem/21921)|https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/136| --- diff --git "a/yuna83/\354\212\254\353\235\274\354\235\264\353\224\251\354\234\210\353\217\204\354\232\260/\353\270\224\353\241\234\352\267\270.py" "b/yuna83/\354\212\254\353\235\274\354\235\264\353\224\251\354\234\210\353\217\204\354\232\260/\353\270\224\353\241\234\352\267\270.py" new file mode 100644 index 00000000..fccc8bf6 --- /dev/null +++ "b/yuna83/\354\212\254\353\235\274\354\235\264\353\224\251\354\234\210\353\217\204\354\232\260/\353\270\224\353\241\234\352\267\270.py" @@ -0,0 +1,26 @@ +import sys +input=sys.stdin.readline + +n,x=map(int,input().split()) +data=list(map(int,input().split())) + +if max(data) == 0: + print("SAD") +else: + value = sum(data[:x]) # x개씩 윈도우 생성 + max_value=value + max_cnt=1 + + for i in range(x,n): + value+=data[i] + value-=data[i-x] + + if value > max_value: + max_value=value + max_cnt =1 + + elif value == max_value: + max_cnt+=1 + + print(max_value) + print(max_cnt) \ No newline at end of file