|
|
вернуться в форумHelp! My program always gets WA! Послано abc 16 окт 2002 08:20 Is there always a path from the top left corner to the bottom right corner? Attached is my program which gets WA. Can anyone give me some tests (preferably those tests that make my program produce wrong answer)? #include <stdio.h> char map[34][34],v[34][34]; int n,count; const int x[4]={-1,0,1,0}; const int y[4]={0,1,0,-1}; void dfs(int i,int j){ int k; v[i][j]=1; for(k=0;k<4;k++){ if(i+x[k]<0 || i+x[k]>=n || j+y[k]<0 || j+y[k]>=n || map[i+x[k]][j+y[k]]=='#') count++; else if(!v[i+x[k]][j+y[k]]) dfs(i+x[k],j+y[k]); } } void main(){ int i,j; scanf("%d",&n); for(i=0;i<n;i++) scanf("%s",map[i]); for(i=0;i<n;i++) for(j=0;j<n;j++) v[i][j]=0; count=0L; dfs(0,0); printf("%d",9*(count-4)); } Re: Help! My program always gets WA! Try this map. 3 .#. ##. ... 108 Thank you very much! I get AC! Послано abc 29 окт 2002 12:51 Re: Help! My program always gets WA! Послано SSS 31 дек 2005 14:35 AC! Thank you a lot! |
|
|