Skip to content

SP 9686题解

Published: at 04:06

思路

数据范围是 1N161\leq N\leq16,果断考虑手算 + 找规律。徒手画出前几个图形,拿去 OEIS 找规律,发现正好可以和这个吻合,于是就可以水过了。

至于找规律的过程,如下:

代码

#include<bits/stdc++.h>
using namespace std;
long long n,a[30]={0,1,1,1,4,6,19,43,120,307,866,2336,6588,18373,52119,147700,422016,1207477,3471067,
		9999135,28893560,83665729,242826187,706074369,2056870697,6001555275,17538335077,51323792789};
int main(){
	cin>>n;
	for (int i=1;i<=n;i++){
		int tmp;
		cin>>tmp;
		cout<<"Case #"<<i<<": "<<a[tmp]<<endl;
	}
	return 0;
}