#include<cstdio> #include<cstring> #include<algorithm> using namespace std; int dp[1200][20], s; int f(int x, int y) { if (x == 0 || y > 19) return int(1e9); if (x == s) return 0; if (dp[x][y] != -1) return dp[x][y]; int t = f(x - 1, y + 1) + 1; for (int i = 2; i*x < 1200; i++) t = min(t, f(i*x, y) + i); return dp[x][y] = t; } int main() { scanf("%d", &s); memset(dp, -1, sizeof(dp)); printf("%d", f(1, 0)); return 0; }
14226번: 이모티콘
https://www.acmicpc.net/problem/14226
피드 구독하기:
댓글
(
Atom
)
댓글 없음 :
댓글 쓰기