forked from rajatgoyal715/Hackerrank
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPRNGSequenceGuessing.java
40 lines (37 loc) · 1.07 KB
/
PRNGSequenceGuessing.java
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
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t--!=0){
int l1=sc.nextInt();
int l2=sc.nextInt();
int a[]=new int[10];
for(int i=0;i<10;i++){
a[i]=sc.nextInt();
}
for(int i=l1;i<=l2;i++){
boolean flag=false;
int seed=i;
Random r = new Random(seed);
for(int j=0;j<10;j++){
if(r.nextInt(1000)!=a[j]){
flag=true;
break;
}
}
if(!flag){
System.out.print(seed);
for(int j=0;j<10;j++){
System.out.print(" "+r.nextInt(1000));
}
System.out.println();
}
}
}
}
}