-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQues5.html
More file actions
134 lines (103 loc) · 4.22 KB
/
Ques5.html
File metadata and controls
134 lines (103 loc) · 4.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<!DOCTYPE html>
<html>
<head>
<title> Ques 5 </title>
<link href="style2.css" rel="stylesheet" type="text/css">
</head>
<script language="JavaScript">
//disable right click
document.addEventListener('contextmenu', event => event.preventDefault());
//disable inspect shortcuts
document.onkeydown = function(e) {
if(event.keyCode == 123) {
return false;
}
if(e.ctrlKey && e.shiftKey && e.keyCode == 'I'.charCodeAt(0)){
return false;
}
if(e.ctrlKey && e.shiftKey && e.keyCode == 'J'.charCodeAt(0)){
return false;
}
if(e.ctrlKey && e.keyCode == 'U'.charCodeAt(0)){
return false;
}
}
</script>
<script type="text/javascript">
window.history.forward();
function noBack() { window.history.forward(); }
var i=0;
function myfunc()
{
var a=document.myform.q1.value;
if(i<=3)
{
if(a=="10")
{ alert("You got it right " );
window.location.replace("pass5.html");
}
else
{i++;
if(i==1)
{ alert("Two more Chances!" );
}
else if(i==2)
{ alert("One more chance!" );
}
}
}
else
{alert("All attempts are used !" );
window.location.replace(" attempts.html ");
}
}
</script>
<body onload="noBack();" onpageshow="if(event.persisted) noBack():" onunload="" ;
background="codinggif.gif">
<header>
<div class="headline">
<h1> <u><br> Question 5 </u></h1>
</div>
<p> Avenger’s spacecraft is being attacked by Thanos droids. Again, Thanos droids intend to disable rather than destroy their targets. They achieve this by introducing bugs in the program of the underlying software.
<br>One important module of every navigation controller is this code :
<br>n <- number of vertices in the graph
<br>adj[n][n] <- adjacency matrix(0/1) of a simple undirected graph
<br>connected[n][n] <- 2D matrix of size n * n
<br>for (i=1; i<=n; i++)
<br> for (j=1; j<=n; j++)
<br> connected[i][j] = adj[i][j]
<br>for (p=1; p<=n; p++) // runs only up to n-k after reprogramming
<br> for (i=1; i<=n; i++)
<br> for (j=1; j<=n; j++)
<br> connected[i][j] = (connected[i][j]) || (i!=j && connected[i][p] && connected[p][j])
<br>return connected
<br>Due to reprogramming by Thanos droids, now the outer loop on p runs only from 1 to n-k (both inclusive).
<br>Your task is to find the number of simple undirected unweighted graphs for which the reprogrammed code still returns the correct answer. Two graphs are considered different if their adjacency matrices are not identical.
<br>Input
<br>The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
<br>Each test case consists of single line containing two integers, n and k.
<br>Output
<br>For each test case, output a single line containing the number of graphs (modulo 10^9+7) for which the buggy code returns correct answer.
<br>Constraints
<br>• 1 ≤ T ≤ 17000
<br>• 1 ≤ n ≤ 180
<br>• 0 ≤ k ≤ n
<br>If Input is:
<br>3
<br>1 1
<br>2 2
<br>3 1
<br>What is the Sum of the outputs?
<form name= "myform" action=" " method="post">
<div>
<label for="Solution"> Solution </label>
<input type="text" autocomplete="off" name="q1">
</div>
<div>
<input type="button" class="submit" value="Submit" onclick="myfunc ()">
</div>
</form>
</p>
</header>
</body>
</html>