Recent Posts
Notice
No Rules Rules
공 (feat. 백준, 2695번) 본문
728x90
반응형
공
https://www.acmicpc.net/problem/2695
반응형
// woohyeon.kim
// kim519620.tistory.com
#include <iostream>
using namespace std;
int main(){
ios::sync_with_stdio(false), cin.tie(NULL);
register int P, B, M, dp[51][1001];
cin >> P;
for(register int p = 0; p < P; ++p) {
cin >> B >> M;
for(register int b = 1, m, mm; b <= B; ++b)
for(m = 1; m <= M; ++m){
if(b == 1) {
dp[b][m] = m;
continue;
}
if(m < b) {
dp[b][m] = dp[b - 1][m];
continue;
}
dp[b][m] = 99999999;
for(mm = 1; mm <= m; ++mm)
dp[b][m] = min(dp[b][m], 1 + max(dp[b - 1][mm - 1], dp[b][m - mm]));
}
cout << dp[B][M] << "\n";
}
return 0;
}
// *&)*@*
아래 "금고 테스트" 와 동일한 문제입니다. 상당히 어렵네요.
금고 테스트 (feat. 백준, 2266번) (tistory.com)
728x90
반응형
'생활 > 코테' 카테고리의 다른 글
Contemporary Art (feat. 백준, 16600번) (0) | 2022.09.08 |
---|---|
Abbey Courtyard (feat. 백준, 15610번) (0) | 2022.09.08 |
금고 테스트 (feat. 백준, 2266번) (0) | 2022.09.08 |
Fly me to the Alpha Centauri (0) | 2022.09.08 |
불 (feat. 백준, 5427번) (0) | 2022.09.07 |
Comments