If you run this code with a larger number for the Fibonacci sequence index (say, 12), you'll end up watching output scroll by for a long time.
如果对大的斐波纳契数列(比如说12)使用这段代码,将会看到长时间的滚动输出。
2
Then print a single line containing the minimal number of swaps of adjacent numbers that are necessary to sort the given sequence. Terminate the output for the scenario with a blank line.
还有一种方法是求数列的逆序数,因为根据题目所给条件,逆序数就是交换次数,代码一并贴出。
3
For each test case, output one line containing the number of nondecreasing subsequences you can find from the sequence S, the answer should % 1000000007.