[백준] 2163번 초콜릿 자르기 / C++
#문제
#풀이
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(false); cin.tie(NULL);
int N, M;
cin >> N >> M;
cout << N * M - 1;
return 0;
}
#정리
DP로 풀어야겠다 싶었는데, 점화식을 찾다보니 규칙이 보였다. 주어진 수를 곱하고 1을 빼서 해결.
Enjoy Reading This Article?
Here are some more articles you might like to read next: