比赛 20150424 评测结果 AAATTTTTTTTTTTT
题目名称 牛跳房子 最终得分 20
用户昵称 wolf. 运行时间 12.835 s
代码语言 C++ 内存使用 4.35 MiB
提交时间 2015-04-24 10:50:25
显示代码纯文本
#include<iostream>
#include<fstream>
#include<bitset>
#include<vector>
#include<deque>
#include<map>
#include<set>
#include<queue>
#include<string>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<cstdio>
using namespace std;
#if defined wolf
const string ok="OK";
const string kk="	";
ofstream nnew("hopscotch.in",ios::app);
ifstream fin("hopscotch.in");
#define fout cout
#define Endl endl
#else
ifstream fin("hopscotch.in");
ofstream fout("hopscotch.out");
#endif
int TT[755][755];
int FF[755][755];
int core(int a,int b){
	//cout<<a<<"  "<<b<<endl;
	long long ans=0;
	int k=TT[a][b];
	for(int i=0;i!=a;++i){
		for(int j=0;j!=b;++j){
			//cout<<i<<kk<<j<<endl;
			if(TT[i][j]!=k){
				ans=(ans+FF[i][j])%1000000007;
			}
		}
	}
	return (int)ans;
}
int main(){
	int a,b,k;
	fin>>a>>b>>k;
	FF[0][0]=1;
	for(int i=0;i!=a;++i){
		for(int j=0;j!=b;++j){
			int e;
			fin>>e;
			TT[i][j]=e;
			if(i>0&&j>0){
				FF[i][j]=core(i,j);
				//cout<<FF[i][j]<<"  ";
			}
		}
		//cout<<endl;
	}
	/*for(int i=1;i!=a;++i){
		for(int j=1;j!=b;++j){
			FF[i][j]=core(i,j);
			cout<<FF[i][j]<<"  ";
		}
		cout<<endl;
	}*/
	fout<<FF[a-1][b-1]<<endl;
	//-------------------------*/
	#if defined wolf
	cout<<endl<<(double)clock()/CLOCKS_PER_SEC<<'s'<<endl;
	#endif
	return 0;
}
//Designed by wolf
//Fri Apr 24 2015