- Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathKiller.java
33 lines (31 loc) · 965 Bytes
/
Killer.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
// problem: https://codeforces.com/problemset/problem/776/A
importjava.util.Scanner;
publicclassKiller{
publicstaticvoidmain(String[] args){
ScannersObj = newScanner(System.in);
String[] persons = newString[2];
String[] temp = newString[2];
inti = 0;
intx = 0;
for(Strings: sObj.nextLine().split(" ")){
persons[i] = s;
i++;
}
intscenarios = Integer.parseInt(sObj.nextLine());
System.out.println(persons[0] + " " + persons[1]);
for(intj=0; j<scenarios; j++){
x=0;
for(Stringz: sObj.nextLine().split(" ")){
temp[x] = z;
x++;
}
if(persons[0].equals(temp[0])){
persons[0] = temp[1];
}
else{
persons[1] = temp[1];
}
System.out.println(persons[0] + " " + persons[1]);
}
}
}