BOJ 2240 : 자두나무
이 문제는 DP로 해결할 수 있다. dp[i][j][k] = i초에 j번 움직이고 k번 나무에 있을 때 최적해 로 두고 풀면 된다. #include #define sanic ios_base::sync_with_stdio(0); #define MEM 1002 #define f first #define s second using namespace std; typedef long long ll; typedef pair pii; const ll MOD = 1e9+7; ll t,n,m,ans; ll dp[MEM][MEM][3]; ll ja[MEM]; main() { sanic; cin.tie(0); cin >> n >> m; for(int i=1; i> ja[i]; for(int i=1; i
2020.06.01