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 |
Tags
- JVM
- 백준 16719
- 백준 17779
- MySQL
- Kotlin
- spring cloud
- 프로그래머스
- 백준
- 백준 16236
- 파이썬
- spring oauth
- 백준 16235
- 프로래머스
- 백준 19238
- springboot
- re.split
- with recursive
- MSA
- Coroutine
- Spring Boot
- java 기술면접
- 백준 파이썬
- JPA
- 웹어플리케이션 서버
- 백준 15685
- spring security
- Spring
- 백준 17626
- java
- sql 기술면접
Archives
- Today
- Total
목록백준 1629 (1)
시작이 반
![](http://i1.daumcdn.net/thumb/C150x150.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/nhh2G/btqZ4AoFP4m/I8CdZwHXKNKacdR1pW44x1/img.png)
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