TheBroj
You are given the n-digit number. You have to perform m operations on it (some of them changing the number). There are three kinds of operations:
1 x - delete digit at position x in the current number (the rest of digits are then merging, and we get a new number that has one digit less)
2 x y - swap digits at positions x and y in the current number
3 - write the value of the current number modulo 10.007
Numbers x and y in operations 1 and 2 will always be less than or equal to the number of digits in current number. It is possible that in some moment we get a number with leading zeroes. Your task is to simulate these operations.
This is an interactive task, meaning that you should immediately write your answer after each operation of type 3. Only after your program writes the result for that operation (whether it is correct or not) you will be able to read next operation.
Also, make sure you ALWAYS flush the output before waiting for feedback. After writing the sequence, use:
cout.flush() in c++
fflush(stdout) in c
flush(output) in pascal
Input:
10234
6
1 1
3
2 2 4
3
1 3
3 Output:
234
432
42For given example, your program should run like this:
Read: 10234
Read: 6
Read: 1 1
Read: 3
Write: 234
Read: 2 2 4
Read: 3
Write: 432
Read: 1 3
Read: 3
Write: 42
TerminateSubmit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.