我写的搜索程序太慢了……没敢提交上去……写了个交表的程序。猥琐地飘过……
以下是我的代码:
#include<iostream>
using namespace std;
const long cheat[9][67]={{0},
{1,1},
{1,4,4},
{1,9,26,26,8},
{1,16,92,232,260,112,16},
{1,25,240,1124,2728,3368,1960,440,32},
{1,36,520,3896,16428,39680,53744,38368,12944,1600,64},
{1,49,994,10894,70792,282248,692320,1022320,867328,389312,81184,5792,128},
{1,64,1736,26192,242856,1444928,5599888,14082528,22522960,22057472,12448832,3672448,489536,20224,256}};
int main()
{
long n,k;
while(cin>>n>>k)
{
if(n==0&&k==0) break;
cout<<cheat[n][k]<<endl;
}
return 0;
}
posted on 2010-11-12 22:04
lee1r 阅读(742)
评论(1) 编辑 收藏 引用 所属分类:
题目分类:搜索