Skip to content

Commit

Permalink
29-yuna83
Browse files Browse the repository at this point in the history
  • Loading branch information
yuna83 committed Feb 13, 2024
1 parent eda9e3b commit 45ff738
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions yuna83/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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|
---
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 45ff738

Please sign in to comment.