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 |
Tags
- Window-Via-c/c++
- 김영한
- 운영체제
- Spring
- 열혈 TCP/IP 소켓 프로그래밍
- HTTP
- FIFO paging
- 열혈 tcp/ip 프로그래밍
- 스프링 핵심 원리
- OS
- 우아한레디스
- 토마토
- Four Squares
- Operating System
- Operating System.
- 10026번
- C#
- 2475번
- 스프링 입문
- 윤성우 저자
- C++
- inflearn
- BOJ
- n타일링2
- 우아한 테크 세미나
- 에러핸들링
- 이펙티브코틀린
- redis
- TCP/IP
- 제프리리처
Archives
- Today
- Total
나의 브을로오그으
[c++] 1463번 : 1로 만들기 본문
https://www.acmicpc.net/problem/1463
#include <iostream>
using namespace std;
#define MIN(a, b) (a < b ? a : b)
int F(int N)
{
if (N <= 1) return 0;
int s1 = F(N / 3) + N % 3 + 1;
int s2 = F(N / 2) + N % 2 + 1;
return MIN(s1, s2);
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int N = 0, min = 0;
cin >> N;
min = F(N);
cout << min << '\n';
return 0;
}
'알고리즘 > BaekJoon' 카테고리의 다른 글
[c++] 1620번 : 나는야 포켓몬 마스터 이다솜 (0) | 2022.06.12 |
---|---|
[c++] 1541번 : 잃어버린 괄호 (0) | 2022.06.07 |
[c++] 1389번 : 케빈 베이컨의 6단계 법칙 (0) | 2022.06.02 |
[c++] 1260번 : DFS와 BFS (0) | 2022.05.31 |
[c++] 1107번 : 리모컨 (0) | 2022.05.30 |