摘要:
这题是记忆化搜索:#include<iostream>#include<cstdio>#include<cstring>using namespace std;int map[124][124];int ans[124][124];int N,M;int DFS( int x ,int y ){ int sum = 0; if( x == N && y == M ) return 1; if( ans[x][y]>=0 ) return ans[x][y]; for( int i=0; i<= map[x][y] ; i++ ) 阅读全文
摘要:
刚开始用暴搜一直RE了,后来加了一个标记就是把字符串转化成数字,如果出现过就标记它;有一组测试数据就是1111与5555是16;#include<iostream>#include<cstdio>#include<cstring>using namespace std;class Node{public: int step; char c[6]; Node() { memset( c , 0, sizeof( c ) ); } };char num1[6],num2[6];Node queue[10024];bool hash[10000];bool pus 阅读全文
摘要:
简单的搜索题:#include<iostream>#include<cstdio>#include<cstring>using namespace std;int flag,Count,step;char map[15][15];int STEP[15][15];bool hash[15][15];void DFS( int x, int y, int cnt ){ if( hash[x][y] ) {// flag =2; Count = cnt - STEP[x][y]; step = STEP[x][y... 阅读全文