Travel Time limit:1500/1000 MS (java/others) Memory limit:131072/131072 K (java/others)
Total submission (s): 2149 Accepted Submission (s): 740
Problem Description Jack likes to travel around the world, but he doesn ' t like to wait. Now, he's traveling in the Undirected kingdom. There is n cities and m bidirectional roads connecting the cities. Jack hates waiting too long on the bus, but he can rest at every city. Jack can only stand staying on the bus for a limited time and would go berserk after. Assuming know the time it takes to go from one city to another and that the time Jack can stand staying on a bus is X Minutes, how many pairs of the city (A, a, a, b) is there that Jack can travel from city A to B. without going berserk?
Input The first line contains one integer t,t≤5, which represents the number in test case.
For each test case, the first line consists of three integers n,m and q where n≤20000,m≤100000,q≤5000. The undirected kingdom has n cities and Mbidirectional roads, and there is Q queries.
Each of the following m lines consists of three integers a, B and D where A,b∈{1,..., n} and d≤100000. It takes Jack D minutes to the