We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

Answering discussions about looping cases such as 2-3 ; 2-3-1-2-3 ; 2-3-1-2-3-1-2-3 .

A cost is used as ending digit only in Solution. Meaing 1, 11, 101,111,201,991 all are same for costs this problem purpose. So unless looping creates costs ending with new digits, looping does not have impact on cost. Suppose a loop is having cost 100. It's equivalent to having cost 0. It does not matter how many times you loop around, it's not going to change ending digit. A looping between nodes of an Edge will give cost of 1000, which is equivalent to 0. This loop does not impact outcome. If problem was for absolute cost, even looping would have impacted outcome very differently, leading to infinite costs. However, in current problem even infinite looping can result only in 10 types of costs.

All pair of (2,3) have costs ending with digit 1 or digit 6, irrespective of looping.

2-3 = 411

2-3-1-2-3= 1476

2-3-1-2-3-1-2-3= 2541

2-3-1-2-3-1-2-3-1-2-3=3606

2-3-1-2-3-1-2-3-1-2-3-1-2-3=4671

so on...

For a given digit you take a pair (x,y) only once. You can take (x,y) pair for all ten digits if you can show paths-costs ending at all possible digits.

In given example pair 2-3 can be counted only for digit 1 and digit 6.
Basically this loop costs 1065, which ends in digit 5. So in each second loops the cost will be 10 making total cost ending at same digit as no-loop iteration. Looping adds only one extra digit, it does not create all random possilities.

Suppose for a given pair of (x,y) a there is a loop cost ends at 1, in that case looping will add one digit each iteration. x,y pair will have costs ending in all 10 digits.

Suppose for a given pair of (x,y) a there is a loop cost ends at 2, in that case looping will add 5 more costs of type.

## Toll Cost Digits

You are viewing a single comment's thread. Return to all comments →

Answering discussions about looping cases such as 2-3 ; 2-3-1-2-3 ; 2-3-1-2-3-1-2-3 .

A cost is used as ending digit only in Solution. Meaing 1, 11, 101,111,201,991 all are same for costs this problem purpose. So unless looping creates costs ending with new digits, looping does not have impact on cost. Suppose a loop is having cost 100. It's equivalent to having cost 0. It does not matter how many times you loop around, it's not going to change ending digit. A looping between nodes of an Edge will give cost of 1000, which is equivalent to 0. This loop does not impact outcome. If problem was for absolute cost, even looping would have impacted outcome very differently, leading to infinite costs. However, in current problem even infinite looping can result only in 10 types of costs.

All pair of (2,3) have costs ending with digit 1 or digit 6, irrespective of looping.

2-3 = 411

2-3-1-2-3= 1476

2-3-1-2-3-1-2-3= 2541

2-3-1-2-3-1-2-3-1-2-3=3606

2-3-1-2-3-1-2-3-1-2-3-1-2-3=4671

so on...

For a given digit you take a pair (x,y) only once. You can take (x,y) pair for all ten digits if you can show paths-costs ending at all possible digits.

In given example pair 2-3 can be counted only for digit 1 and digit 6. Basically this loop costs 1065, which ends in digit 5. So in each second loops the cost will be 10 making total cost ending at same digit as no-loop iteration. Looping adds only one extra digit, it does not create all random possilities.

Suppose for a given pair of (x,y) a there is a loop cost ends at 1, in that case looping will add one digit each iteration. x,y pair will have costs ending in all 10 digits.

Suppose for a given pair of (x,y) a there is a loop cost ends at 2, in that case looping will add 5 more costs of type.