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
- JPA
- java 기술면접
- 백준 16719
- springboot
- 프로그래머스
- MSA
- 백준 15685
- 백준
- Spring Boot
- 프로래머스
- spring security
- 파이썬
- spring cloud
- 백준 17779
- 백준 16235
- JVM
- with recursive
- Kotlin
- java
- Spring
- re.split
- Coroutine
- 백준 17626
- sql 기술면접
- 백준 파이썬
- 백준 16236
- 웹어플리케이션 서버
- 백준 19238
- spring oauth
- MySQL
Archives
- Today
- Total
목록백준 1629 (1)
시작이 반

A를 B번 곱한 수의 C로 나눈 나머지를 구하는 것이다. A, B, C는 모두 2,147,483,647 이하의 자연수다. 즉 반복문으로는 절대 풀수없다. 때문에 분할 정복을 선택하였다. 첫 풀이 a, b, c = map(int, input().split(' ')) def dnc(length): if length == 1: return a if length % 2 == 0: left = dnc(length // 2) return left * left else: left = dnc(length // 2) return left * left * a print(dnc(b)) 이렇게 푸니까 시간초과가 나왔다.. 검색해보니 오버플로우도 시간초과가 나온다고 한다.???음? 생각해보니 a, b모두 엄청 큰 숫자가 들어오..
알고리즘/백준
2021. 3. 15. 22:31