Maurice Tutor

(5)

$15/per page/Negotiable

About Maurice Tutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Algebra,Applied Sciences See all
Algebra,Applied Sciences,Biology,Calculus,Chemistry,Economics,English,Essay writing,Geography,Geology,Health & Medical,Physics,Science Hide all
Teaching Since: May 2017
Last Sign in: 398 Weeks Ago, 6 Days Ago
Questions Answered: 66690
Tutorials Posted: 66688

Education

  • MCS,PHD
    Argosy University/ Phoniex University/
    Nov-2005 - Oct-2011

Experience

  • Professor
    Phoniex University
    Oct-2001 - Nov-2016

Category > Computer Science Posted 16 Sep 2017 My Price 6.00

different paths

Problem Description

 

Utkarsh has come to a new country having N cities(numbered from 1to N). There are M directed roads in the country each of length 1 unit. Utkarsh is very lazy so he cannot walk more thanK units.

 

He has Q queries. Each query is of the form a b. For each query he wants to know how many different paths (of positive length) are there from city a to b which Utkarsh can walk.

 

Output the answer modulo 10^9+7.

 

INPUT

 

First line contains N,M,K
next line contains M pairs a b denoting a directed road from a to b.
Next line contains Q.
Then Q pairs follow.

 

OUTPUT

 

For each pair, print the answer to the problem modulo 10^9+7.

 

CONSTRAINTS

 

 

  • N
  • K
  • M
  • 1
  • Q

 

Example 1

Input
3 4 2 1 1 2 2 3 3 1 1 1 1 1 Output
6

 

 

Example 2

Input
3 5 3 1 1 1 2 2 2 2 3 3 3 2 1 3 2 3 Output
4 6

Answers

(5)
Status NEW Posted 16 Sep 2017 02:09 PM My Price 6.00

Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll

Not Rated(0)