Skip to content

Commit 034699c

Browse files
committed
[Silver V] Title: 수들의 합, Time: 52 ms, Memory: 32412 KB -BaekjoonHub
1 parent a54df89 commit 034699c

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# [Silver V] 수들의 합 - 1789
2+
3+
[문제 링크](https://www.acmicpc.net/problem/1789)
4+
5+
### 성능 요약
6+
7+
메모리: 32412 KB, 시간: 52 ms
8+
9+
### 분류
10+
11+
그리디 알고리즘, 수학
12+
13+
### 제출 일자
14+
15+
2025년 3월 12일 21:45:20
16+
17+
### 문제 설명
18+
19+
<p>서로 다른 N개의 자연수의 합이 S라고 한다. S를 알 때, 자연수 N의 최댓값은 얼마일까?</p>
20+
21+
### 입력
22+
23+
<p>첫째 줄에 자연수 S(1 ≤ S ≤ 4,294,967,295)가 주어진다.</p>
24+
25+
### 출력
26+
27+
<p>첫째 줄에 자연수 N의 최댓값을 출력한다.</p>
28+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# 1789 수들의 합
2+
# tlfqj 5
3+
4+
import sys
5+
6+
s = int(sys.stdin.readline())
7+
8+
total = 0
9+
count = 0
10+
11+
while True:
12+
count += 1
13+
total += count
14+
if total > s:
15+
break
16+
17+
print(count-1)

0 commit comments

Comments
 (0)