HUD 1165

#include <bits/stdc++.h>
using namespace std;
const int MAX_V = 1000001;
int dp[4][MAX_V];
void init()
{
	dp[3][0] = 5;
	for (int i = 0; i < MAX_V; i++)
	{
		dp[0][i] = i + 1;
		dp[1][i] = i + 2;
		dp[2][i] = 2 * i + 3;
		if (i > 0 && i < 25)
			dp[3][i] = 2 * dp[3][i - 1] + 3;
	}
}
int main(int argc, char const *argv[])
{
	int n, m;
	init();
	while (cin >> m >> n)
		cout << dp[m][n] << endl;
	return 0;
}
归类为dp,这真坑

你可能感兴趣的:(HUD 1165)