]]>HDU 1010 Tempter of the Bonehttp://www.shnenglu.com/vontroy/archive/2010/07/29/121519.htmlVontroyVontroyWed, 28 Jul 2010 22:58:00 GMThttp://www.shnenglu.com/vontroy/archive/2010/07/29/121519.htmlhttp://www.shnenglu.com/vontroy/comments/121519.htmlhttp://www.shnenglu.com/vontroy/archive/2010/07/29/121519.html#Feedback0http://www.shnenglu.com/vontroy/comments/commentRss/121519.htmlhttp://www.shnenglu.com/vontroy/services/trackbacks/121519.html#include <iostream> #include <cstdio> #include <cmath>
constint maxn =10;
usingnamespace std;
bool escape;
char map[maxn][maxn];
int dir[4][2] = {{-1,0}, {1,0}, {0,-1}, {0,1}}; int n, m, t; int si, sj, di, dj;
void dfs( int x, int y, int cnt ) { if( escape ) return;
if( x == di && y == dj && cnt == t ) { escape =1; return; }
int temp = t - cnt - ( fabs(di - x) + fabs(dj - y ) );
if( temp <0|| temp %2!=0 ) return;//濂囧伓鍓灊 if( x <=0|| y <=0|| x > n || y > m ) return;
for( int i =0; i <4; i++ ) { if( map[x+dir[i][0]][y+dir[i][1]] !='X') { map[x+dir[i][0]][y+dir[i][1]] ='X'; dfs(x+dir[i][0], y+dir[i][1], cnt+1); map[x+dir[i][0]][y+dir[i][1]] ='.'; } }
}
int main() { while( cin >> n >> m >> t, m || n || t ) { int wall =0; escape =0; for ( int i =1; i <= n; i++ ) for ( int j =1; j <= m; j++ ) { cin >> map[i][j];