Groups
Groups
Sign in
Groups
Groups
cs101pku
Conversations
About
Send feedback
Help
回复:有关《POJ4113:北京地铁票价-BeiJing_Subway》的算法讨论
46 views
Skip to first unread message
刘静嘉
unread,
Dec 25, 2016, 8:45:42 PM
12/25/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to cs101pku
其中一站为中转站其实不需要单独讨论
----- 原始邮件 -----
发件人:杨晨_1400015437 <
ychop...@gmail.com
>
收件人:cs101pku <
cs10...@googlegroups.com
>
主题:有关《POJ4113:北京地铁票价-BeiJing_Subway》的算法讨论
日期:2016年12月25日 20点04分
原题链接:
http://bailian.openjudge.cn/practice/4113
北京地铁票价这一题我用的算法很麻烦,所以发上来看看大家有什么其他比较好的算法。我用的方法是定义dis1和dis2两个二维数组,dis1[a][b]表示第a和b个车站之间的距离,然后用sta1和sta2两个数组分别存两条线路的车站名称,读入的时候使用dictionary标记每个车站名属于哪一条线路,并且标记交叉点的位置。最后求解的时候不仅需要去找站名在线路里的具体位置,而且写了8种判断条件……分别有两个站在同一条线上、不在同一条线上、两个站中其中一站为中转站。这样对于L=1和L=2基本上相当于是写了两个程序,代码很长而且调试十分麻烦,弄了很久才AC。所以想问问大家有什么比较好的算法,能够把两条线路的求解比较统一的结合起来的?能否将信息存在每个站点的结构体里面然后直接根据站名来判断呢?
--
您收到此邮件是因为您订阅了 Google 网上论坛的“cs101pku”群组。
要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到
cs101pku+u...@googlegroups.com
。
要向此群组发帖,请发送电子邮件至
cs10...@googlegroups.com
。
访问此群组:
https://groups.google.com/group/cs101pku
。
要查看更多选项,请访问
https://groups.google.com/d/optout
。
杨晨_1400015437
unread,
Dec 26, 2016, 9:15:32 AM
12/26/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to cs101pku
嗯其实是我当时使用字典标注的时候把中转站标注的和两条线路都不一样了,现在想着应该还是单独设一个变量比较合适
Reply all
Reply to author
Forward
0 new messages