Given sequence of 8 balls arranged horizontally numbered 1, 2, 3, 4, 5, 6, 7, 8 after N number of operations specified by the user.
- Downlaod & install latest version of Java(JDK) from official site of Oracle
- Setting system environment variable(Windows Operating system) : Right Click on My Computer -> Properties -> Advance System Settings -> Environment Variables. Under System Variables select Path -> edit. Copy the location ;C:\Program Files\Java\jdk1.8.0_91\bin; and paste to the variable Value -> Ok -> Ok -> Ok.
Download the project click here. Unzip the downloaded file.
Option 1: Using Command Prompt -> Go to the project src folder -> Compile the java file using command : javac com/chanchal/operation/Operation.java -> Run the program : java com.chanchal.operation.Operation
Option 2: Download & install the latest version of Eclipse -> Import the project(Right Click on project explorer -> Import -> General -> Existing projects into workspace -> browser location -> Finish) -> Open Operation.java file in the eclipse -> Run the java file using key Ctrl + F11
Input by the user :
N K
A_1 B_1
A_2 B_2
.
.
.
A_N B_N
(Where N specify the number of Operations, K specify the number of sets)
Range of N : 1≦N≦50
Range of K : 1≦K≦10^9
Range of A_i, B_i : 1≦(A_i,B_i)≦50
The output should be a single line with the number for each ball in their final order, with a space between each number
4 2
1 2
2 3
3 4
4 1
1 4 2 3 5 6 7 8
