94532024-02-21 21:08:47ananászDinamitcpp17Forditási hiba
// dinamit3.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;


int main()
{	int N, M, K;
	cin >> N >> M >> K;
	vector<vector<vector<int>>>dp(N +1, vector<vector<int>>(M +1, vector<int>(K+1, INT_MAX)));
	vector<vector<int>>t(N +1, vector<int>(M +1));
	for (int i = 1; i <= N; i++)
	{
		for (int j = 1; j <= M; j++)
		{
			cin >> t[i][j];
		}
	}
	for (int k = 0; k <= K; k++)
	{
		for (int i = 1; i <= N; i++)
		{
			for (int j = 1; j <= M; j++)
			{
				int x = t[i][j];
				for (int l = 0; l <= k; l++)
				{
					if (i == 1 && j == 1) 
					{
						dp[i][j][k] = x;
					}
					else
					{
						dp[i][j][k] = min(dp[i][j][k], min(dp[i - 1][j][k - l], dp[i][j - 1][k - l]) + x);
						
					}
					x =x/2;
				}
			}
		}
	}
	
	cout << dp[N][M][K] << '\n';
	return 0;
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
Forditási hiba
exit status 1
main.cpp: In function 'int main()':
main.cpp:15:88: error: 'INT_MAX' was not declared in this scope
   15 |         vector<vector<vector<int>>>dp(N +1, vector<vector<int>>(M +1, vector<int>(K+1, INT_MAX)));
      |                                                                                        ^~~~~~~
main.cpp:8:1: note: 'INT_MAX' is defined in header '<climits>'; did you forget to '#include <climits>'?
    7 | #include <algorithm>
  +++ |+#include <climits>
    8 | 
Exited with error status 1