| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 12149 | moocHW6b |
|
| 12150 | moocFinal5_迴旋 |
|
Description
Complete the unzip function based on the sample code. The purpose of the function is to turn a list of pairs into a pair of lists.
For notation, square brackets [] represent list and parentheses () represent pair.
For example, a list of pairs [(1,"a"),(2,"b"),(3,"c")] after unzip will become ([1,2,3],["a","b","c"]).
If there are two lists [1,2,3] and ["a","b","c"], they will become [("a",(1,"a")),("b",(2,"b")),("c",(3,"c"))] after two zip operations from the first problem(10193). Then, it will become (["a","b","c"],[(1,"a"),(2,"b"),(3,"c")]) after one unzip.
For this problem you need to get the resulting pair from two lists after N zip operations and then one unzip operation.
The above operation is already completed in the sample code. You only have to complete unzip correctly to get the correct result.
Hint:
Input
It’s the same with the first problem. There will be five lines of input.
The first line is an integer M1 representing the number of data of the first list.
The second line contains M1 data, each separated by space.
The third line is an integer M2 representing the number of data of the second list.
The fourth line contains M2 data, each separated by space.
The fifth line is an integer N representing the number of times zip is executed.
Output
There is only one line of output, which is the content of the pair after N zip operations and then one unzip operation. There should be a newline at the end.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Input two integers M and N. Generate a MxN matrix circling clockwise from the outer ring to the center.
For example, M is 3 and N is 4:
1 2 3 4
10 11 12 5
9 8 7 6
And another example, M is 4 and N is 4:
1 2 3 4
12 13 14 5
11 16 15 6
10 9 8 7
The problem will ask for a number and you need to output where it is.
Input
Three integers M, N, and P.
This means you need to find where number P is in the MxN circling matrix. M and N won’t exceed 30.
Output
Two numbers separated by space. Remember to add newline at the end.
The two numbers represent row and column respectively.