10917 - Walk Through the Forest翻译

Problem C: A Walk Through the Forest
Jimmy experiences a lot of stress at work these days, especially since his accident made working difficult.
漫步森林
Jimmy这些天工作感觉很压力,尤其以后他的事故使工作困难
To relax after a hard day, he likes to walk home.
辛苦工作一天后去放松,他想走路回家
To make things even nicer, his office is on one side of a forest, and his house is on the other.
使事情更好,他的办公室在森林的一侧,他的房子在另一侧
A nice walk through the forest, seeing the birds and chipmunks is quite enjoyable.
通过森林散步很好,看鸟和花栗鼠很愉快
The forest is beautiful, and Jimmy wants to take a different route everyday. He also wants to get home before dark, so he always takes a path to make progress towards his house.
森林很美丽,Jimmy想走不同的路线每天。他想天黑前回家,所以他总是选一条路朝着他的房子前进
He considers taking a path from A to B to be progress if there exists a route from B to his home that is shorter than any possible route from A.
他认为选一个路径A到B前进,从B到他的家比从A到他的家任何路线都短
Calculate how many different routes through the forest Jimmy might take.
计算Jimmy有多少种不同路线通过森林
Input
Input contains several test cases followed by a line containing 0.
输入包含若干测试数据,以下一行为0
Jimmy has numbered each intersection or joining of paths starting with 1.
Jimmy从编号1开始
His office is numbered 1, and his house is numbered 2.
他的办公室是编号1,他的房子是编号2
The first line of each test case gives the number of intersections N, 1 < N ≤ 1000, and the number of paths M. The following M lines each contain a pair of intersections a b and an integer distance 1 ≤ d ≤ 1000000 indicating a path of length d between intersection a and a different intersection b.
第一行测试数据给一个交点数字N,1<N<=1000,路径M。以下M行包含一对交点 a b 一个整数距离1 ≤ d ≤ 1000000代表a和b路径长度d(a≠b)
Jimmy may walk a path any direction he chooses. There is at most one path between any pair of intersections.
Jimmy可以选不同的路选择。最少一条路在一对交点
Output
For each test case, output a single integer indicating the number of different routes through the forest. You may assume that this number does not exceed 2147483647.
每组测试案例。输出一组整数代表不同路径通过森林。输入保证答案不超过2147483647(2的31次-1)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值