Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- 오픽점수잘받는방법
- 이진탐색 #나무 자르기
- dp
- 탑다운
- 영어말하기
- 영어회화
- 오픽
- stack 스택
- XML주석
- 안드로이드주석
- opic
- 이진탐색
- 오픽노잼공부방법
- 주석
- 오픽공부법
- XML
- English
- 디피
- 오픽노잼
- 오픽가격
- dynamicProgramming
- ㅂ
- topdown
- 바텀업
- 다이나믹프로그래밍
- fibo
- 피보나치수열
- 안드로이드
- 메모이제이션
Archives
RUBY
[백준] 수들의 합 본문
출처:: www.acmicpc.net/problem/1789
분류::
1. 문제 이해 및 해결과정
2. 풀이방법
1.
#수들의 합
#https://www.acmicpc.net/problem/1789
import sys
sys.stdin = open("input.txt","r")
n=int(input())
#x(x+1)/2 = n
x=1
while(x*(x+1)/2 <=n):
x+=1
print(x-1)
2.
#수들의 합
#https://www.acmicpc.net/problem/1789
import sys
sys.stdin = open("input.txt","r")
n=int(input())
#x(x+1)/2 = n
num,sum=1,0
cnt=0
while True:
sum+=num
cnt+=1
if sum>n:
break
num+=1
print(cnt-1)
3. 오답원인
4. 알게된 점
'PS > BOJ' 카테고리의 다른 글
[백준] 에디터 (0) | 2020.09.28 |
---|---|
[백준] 격자상의 경로 (0) | 2020.09.27 |
[백준] 동전2 (0) | 2020.09.26 |
[백준] 1로 만들기 (0) | 2020.09.26 |
[백준] 꽃잎 (0) | 2020.09.24 |
Comments