膜拜Tim神程序。。

 

输入文件:

 

2010-05-16 20:25:49 jiakai@JiaKai tmp 23 1020
$ cat manhattan.in
2 3
WE
NNS
3 9
1 4 2
2
1 3 2 1
2 3 2 2

编译参数:

g++ manhattan.cpp -o manhattan -g -Wall

软件版本:

2010-05-16 20:27:43 jiakai@JiaKai tmp 25 1022
$ g++ --version
g++ (GCC) 4.1.2
Copyright (C) 2006 Free Software Foundation, Inc.
本程序是自由软件;请参看源代码的版权声明。本软件没有任何担保;
包括没有适销性和某一专用目的下的适用性担保。

2010-05-16 20:28:23 jiakai@JiaKai tmp 26 1023
$ gdb --version
GNU gdb (GDB) 7.1
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.

开始gdb:

2010-05-16 20:28:26 jiakai@JiaKai tmp 27 1024
$ gdb ./manhattan
GNU gdb (GDB) 7.1
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /tmp/manhattan...done.
(gdb) b 105
Breakpoint 1 at 0x8048894: file manhattan.cpp, line 105.
(gdb) r
Starting program: /tmp/manhattan

Breakpoint 1, Calculate (s=0) at manhattan.cpp:105
105                     if (x1 == x2)
(gdb) s
110                     if (y1 == y2)
(gdb)
112                     else if (P(s, x1) == diry && P(s, x2) == diry)
(gdb)
113                             AddDemand(y1, y2, dirx);
(gdb)
AddDemand (l=3, r=1, _dir=1) at manhattan.cpp:54
54          Cnt ++;
(gdb)
55          left[Cnt] = l, right[Cnt] = r, dir[Cnt] = _dir;
(gdb)
56      }
(gdb)
Calculate (s=0) at manhattan.cpp:112
112                     else if (P(s, x1) == diry && P(s, x2) == diry)
(gdb)

113行执行完了,又回到了112.。。。 我表示目前无法解释。 记下来,以后慢慢研究。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值