UVa 336 - A Node Too Far

This is a BFS problem. Calculate the costs by BFS traversal. Then count the vertices with costs less than TTL.

Remember source cab be reachable even with 0 cost.