Solutions/Fanta's Solution PKU 1979. Red and Black. AC 지환태 2008. 11. 14. 20:23 #include <stdio.h> char string[20][20]; int y,x=1; int cnt; void back(int yy,int xx) { cnt++; string[yy][xx]='#'; if(yy>0 && string[yy-1][xx]=='.') back(yy-1,xx); if(yy<y-1 && string[yy+1][xx]=='.') back(yy+1,xx); if(xx>0 && string[yy][xx-1]=='.') back(yy,xx-1); if(xx<x-1 && string[yy][xx+1]=='.') back(yy,xx+1); } main() { int yy,xx; int i,j; while(1) { scanf("%d %d",&x,&y); for(i=0;i<y;i++) { scanf("%s",&string[i]); for(j=0;j<x;j++) { if(string[i][j]=='@') { yy=i; xx=j; } } } if(x+y==0) return; cnt=0; back(yy,xx); printf("%d\n",cnt); } } Run ID User Problem Result Memory Time Language Code Length Submit Time 4373822 jht009 1979 Accepted 204K 16MS C 674B 2008-11-14 19:14:59백트래킹으로 AC맞은 건 처음인 것 같아요그나저나 글 소재를 못찾겠네요 ㅇㅅㅇ