HDU 1165 Eddy's research II

题意:已知,求A(m, n).

分析:根据样例模拟一下过程就可以找出递推关系。

#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<iostream>
#include<sstream>
#include<iterator>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<deque>
#include<queue>
#include<list>
#define Min(a, b) a < b ? a : b
#define Max(a, b) a < b ? b : a
typedef long long ll;
typedef unsigned long long llu;
const int INT_INF = 0x3f3f3f3f;
const int INT_M_INF = 0x7f7f7f7f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const ll LL_M_INF = 0x7f7f7f7f7f7f7f7f;
const int dr[] = {0, 0, -1, 1};
const int dc[] = {-1, 1, 0, 0};
const double pi = acos(-1.0);
const double eps = 1e-8;
const int MAXN = 2000000 + 10;
const int MAXT = 10000 + 10;
using namespace std;
ll a[4][MAXN];
int main(){
    for(int i = 0; i <= 2000005; ++i){
        a[1][i] = ll(2) + ll(i);
    }
    for(int j = 0; j <= 1000000; ++j){
        a[2][j] = a[1][2 * j + 1];
    }
    a[3][0] = ll(5);
    for(int i = 1; i <= 24; ++i){
        a[3][i] = a[3][i - 1] * 2 + ll(3);
    }
    int m, n;
    while(scanf("%d%d", &m, &n) != EOF){
        printf("%lld\n", a[m][n]);
    }
    return 0;
}
原文地址:https://www.cnblogs.com/tyty-Somnuspoppy/p/6065786.html