user-0 提问: 运行结果正确，oj总是WA，大家帮忙找找原因

回复:
user: user-1
content: 楼主请记住，以后用二维数组，先y，后x 。a[y][x]

user: user-1
content: 播种机屁股底下那块地也能正常长庄稼？！

user: user-1
content: 说这样 ..... SSSS. ...S. .SSS. .....  也YES的人，我倒要问问你：播种机今年就放地中间就当报废不动了吗？万一下场雨机油流到地里还影响收成呢？

user: user-1
content: 引用 10 楼 fly_dragon_fly 的回复:这里搞混 了吧 if(nx>=0 && nx<m && ny>=0 && ny<n && map[nx][ny]=='.') 你的x是行,y是列, 所以应该是nx<n && ny<m, 另外你的dfs在找到结果就不要再搜了. 不过n,m比较小可能性能影响不大 佩服！比我眼还尖。  不过我的猜想也应该有那么一点点符合实际吧。

user: user-0
content: 引用 10 楼 fly_dragon_fly 的回复:这里搞混 了吧 if(nx>=0 && nx<m && ny>=0 && ny<n && map[nx][ny]=='.') 你的x是行,y是列, 所以应该是nx<n && ny<m, 另外你的dfs在找到结果就不要再搜了. 不过n,m比较小可能性能影响不大 对对对，是这里错了非常感谢

user: user-2
content: 这里搞混 了吧 if(nx>=0 && nx<m && ny>=0 && ny<n && map[nx][ny]=='.') 你的x是行,y是列, 所以应该是nx<n && ny<m, 另外你的dfs在找到结果就不要再搜了. 不过n,m比较小可能性能影响不大

user: user-2
content: 引用 12 楼 zhao4zhong1 的回复:[quote=引用 10 楼 fly_dragon_fly 的回复:] 这里搞混 了吧 if(nx>=0 && nx<m && ny>=0 && ny<n && map[nx][ny]=='.') 你的x是行,y是列, 所以应该是nx<n && ny<m, 另外你的dfs在找到结果就不要再搜了. 不过n,m比较小可能性能影响不大 佩服！比我眼还尖。  不过我的猜想也应该有那么一点点符合实际吧。  [/quote]要是迷宫,就对上了,这个你没细看吧, 刚好这个x,y和笛卡尔的x,y刚好不一样

user: user-3
content: 引用 8 楼 zhao4zhong1 的回复:[quote=引用 5 楼 q3733353520 的回复:] [quote=引用 2 楼 zhao4zhong1 的回复:] 我猜是楼主忽略了一个隐含条件： 最后播种机必须位于田地边缘。否则也应输出NO 赵老师是哪里看到题目的。。。[/quote] 楼主给的链接明显前面多了http:///，去掉就可以上了。[/quote]

user: user-1
content: 引用 5 楼 q3733353520 的回复:[quote=引用 2 楼 zhao4zhong1 的回复:] 我猜是楼主忽略了一个隐含条件： 最后播种机必须位于田地边缘。否则也应输出NO 赵老师是哪里看到题目的。。。[/quote] 楼主给的链接明显前面多了http:///，去掉就可以上了。

user: user-0
content: 题目：   Seeding  --------------------------------------------------------------------------------  Time Limit: 2 Seconds      Memory Limit: 65536 KB   -------------------------------------------------------------------------------- It is spring time and farmers have to plant seeds in the field. Tom has a nice field, which is a rectangle with n * m squares. There are big stones in some of the squares.  Tom has a seeding-machine. At the beginning, the machine lies in the top left corner of the field. After the machine finishes one square, Tom drives it into an adjacent square, and continues seeding. In order to protect the machine, Tom will not drive it into a square that contains stones. It is not allowed to drive the machine into a square that been seeded before, either.  Tom wants to seed all the squares that do not contain stones. Is it possible?   Input  The first line of each test case contains two integers n and m that denote the size of the field. (1 < n, m < 7) The next n lines give the field, each of which contains m characters. 'S' is a square with stones, and '.' is a square without stones.  Input is terminated with two 0's. This case is not to be processed.    Output  For each test case, print "YES" if Tom can make it, or "NO" otherwise.   Sample Input  4 4 .S.. .S.. .... .... 4 4 .... ...S .... ...S 0 0   Sample Output  YES NO

user: user-1
content: 引用 2 楼 zhao4zhong1 的回复:我猜是楼主忽略了一个隐含条件： 最后播种机必须位于田地边缘。否则也应输出NO 除非这个农户有大吊车或大型直升机支援！

user: user-3
content: 引用 2 楼 zhao4zhong1 的回复:我猜是楼主忽略了一个隐含条件： 最后播种机必须位于田地边缘。否则也应输出NO 赵老师是哪里看到题目的。。。

user: user-1
content: 仅供参考（不一定对）： //http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1100 //It is spring time and farmers have to plant seeds in the field. Tom has a nice field, which is a rectangle with n * m squares. //There are big stones in some of the squares. //Tom has a seeding-machine. At the beginning, the machine lies in the top left corner of the field. //After the machine finishes one square, Tom drives it into an adjacent square, and continues seeding. //In order to protect the machine, Tom will not drive it into a square that contains stones. //It is not allowed to drive the machine into a square that been seeded before, either. //Tom wants to seed all the squares that do not contain stones. Is it possible? // //Input //  The first line of each test case contains two integers n and m that denote the size of the field. (1 < n, m < 7) //  The next n lines give the field, each of which contains m characters. //  'S' is a square with stones, and '.' is a square without stones. //  Input is terminated with two 0's. This case is not to be processed. //Output //  For each test case, print "YES" if Tom can make it, or "NO" otherwise. //Sample Input //4 4 //.S.. //.S.. //.... //.... //4 4 //.... //...S //.... //...S //0 0 //Sample Output //YES //NO #include <cstdio> int dx[4]={0,0,1,-1}; int dy[4]={1,-1,0,0}; int n,m,sum,flag; char map[10][10]; void dfs(int y, int x) {     if (sum==0) {         if (x==0 || x==m-1 || y==0 || y==n-1) flag=1;         return;     }     for (int i=0;i<4;i++) {         int nx=x+dx[i];         int ny=y+dy[i];         if (0<=nx && nx<m && 0<=ny && ny<n && map[ny][nx]=='.') {             map[ny][nx] = 'S';             sum--;             dfs(ny,nx);             sum++;             map[ny][nx] = '.';         }     } } int main() {     while (scanf("%d%d",&n,&m),n&&m) {         sum=n*m;         flag=0;         for (int y=0;y<n;y++) {             scanf("%9s",map[y]);             for(int x=0;x<m;x++) {                 if(map[y][x]=='S') sum--;             }         }         map[0][0] ='S';         sum--;         dfs(0,0);         if (flag) printf("YES\n");         else      printf("NO\n");     }     return 0; }

user: user-3
content: scanf("%s",map[i]);//至少要确保map[i]能装得下吧

user: user-1
content: 我猜是楼主忽略了一个隐含条件： 最后播种机必须位于田地边缘。否则也应输出NO

user: user-4
content: 打不开链接哟