Home > Back-end >  Of new bosses to help me take a look at this from the how to write
Of new bosses to help me take a look at this from the how to write

Time:06-09

 n existing disorder but only Numbers, please output after sorting, the position of the largest number,

Input

Input consists of two lines, the first line, given an integer n, then follow the x1, x2, x3,... , xn (n integer), with a space between number, the second line, given the number 0 or 1 (0 means according to the ascending order, 1 in descending order), (1 & lt;=n<=100, xi<=1000000000, I ∈ (1, n])
Program execution to the end of the file

The Output

For each test sample, the output of the position of the largest number, (position starting from 1, has been to n)

The Sample Input

4 5 4 3 2
0
1
21
2 4 3
0
10 1 3 September 7, 4, 5, 2 10 8 6
1

The Sample Output

4
1
2
1

CodePudding user response:

To search the bubble sort, it is very simple

CodePudding user response:

For (p=0, j=1; JIf (a [p] & gt; A [j]) p=j
Print the p

CodePudding user response:

refer to the second floor proorck2019 response:
for (p=0, j=1; JIf (a [p] & gt; A [j]) p=j
Print p

Can you detail can you detail,,,, I good food

CodePudding user response:

Recorded in p minimum, circulation again, after a minimum [p],

CodePudding user response:


I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10581430.html
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10768339.html
  • Related