UVALive 6177 The King's Ups and Downs 规律题

题目链接:点击打开链接

#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
const int N = 22;
ll a[N];
void prepare() {
a[1] = 1,a[2] = 2,a[3] = 4,a[4] = 10,a[5] = 32,a[6] = 122,a[7] = 544,a[8] = 2770
,a[9] = 15872,a[10] = 101042,a[11] = 707584,a[12] = 5405530,a[13] = 44736512,a[14] = 398721962,
a[15] = 3807514624ll,
a[16] = 38783024290ll,
a[17] = 419730685952ll,
a[18] = 4809759350882ll,
a[19] = 58177770225664ll,
a[20] = 740742376475050ll;
}
int main() {
	prepare();
	int cas;
	scanf("%d", &cas);
	while (cas -- > 0) {
		int i;
		scanf("%d", &i);
		printf("%d ", i);
		scanf("%d", &i);
		cout << a[i] << endl;
	}
	return 0;
}


你可能感兴趣的:(UVALive 6177 The King's Ups and Downs 规律题)