Click here to Skip to main content

SALIL GAURAV asked:

Open original thread
Module the answer by 1007...........what does this statement mean?I am getting a answer but final answer is determined by this statement????
 
i am getting a number>=0 and that number is answer but probblem states Module the answer by 1007
 
here is problem:
There are n variables and m requirements. Requirements are represented as (x <= y), which means the x-th variable must be smaller or equal to the y-th variable. Assign nonnegative numbers smaller than 10 to each variable. Please calculate how many different assignments that match all requirements. Two assignments are different if and only if at least one variable is assigned different number in these two assignment. Module the answer by 1007.
 
Input Format:
First line of the input contains two integers n and m. Then following m lines each containing 2 space-seperated integers x and y, which means a requirement (x <= y).
 
Output Format:
Output the answer in one line.
 
Constraints:
0 < n < 14
0 < m < 200
0 <= x, y < n
 
Sample Input:
6 7
1 3
0 1
2 4
0 4
2 5
3 4
0 2
 
Sample Output: 1000
 
EDIT: added more information from a comment below - lewax00
Tags: C++, C, Java, Perl, Python

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).



Advertise | Privacy | Mobile
Web01 | 2.6.130516.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid