Write a program to mirror and shift a binary file.
Task Description
Given the names of an input binary file of L bytes, the name for an output file and an integer N, mirror the file first, then shift the left N bytes and write the contents to the output binary file. For example, if a file consists of 00010011 01011100 00100110 11000101, after mirroring, it will be 10100011 01100100 00111010 11001000. Then we shift left 3 bytes, it will be 11001000 10100011 01100100 00111010.
Subtask
10 points: The whole file can be read into memory and N is 0.
20 points: The whole file can be read into memory and N is between 0 and L - 1.
70 points: The file will be too large to read into memory.
Input Format
The input contains only one test case. There are two strings and one integer in the first line. The first string is the name of the input file and the second string is the name of the output file. The second line of the input is N. The name of the files have no more than 16 characters.
Write a program to mirror and shift a binary file.
Task Description
Given the names of an input binary file of L bytes, the name for an output file and an integer N, mirror the file first, then shift the left N bytes and write the contents to the output binary file. For example, if a file consists of 00010011 01011100 00100110 11000101, after mirroring, it will be 10100011 01100100 00111010 11001000. Then we shift left 3 bytes, it will be 11001000 10100011 01100100 00111010.
Subtask
Input Format
The input contains only one test case. There are two strings and one integer in the first line. The first string is the name of the input file and the second string is the name of the output file. The second line of the input is N. The name of the files have no more than 16 characters.
Output Format
Write a binary file with given output file name.
Sample Input 1
Sample Input binary file 1
0-in.dat
Sample Output binary file 1
0-out.dat
Sample Input 2
Sample Input binary file 2
1-in.dat
Sample Output binary file 2
1-out.dat
Sample Input 3
Sample Output 3
2-out.dat