How to implement this problem in Python

CSDN Q & A 2022-01-15 03:51:35 阅读数:18

implement problem python

Digital games
The time limit :2 s
Memory limit :256 MB
Given a sequence n Positive numbers a1, a2, ……, an. As long as there are different numbers , Just do the following : Select a maximum number and subtract the minimum number from it . How many operations will be performed ? The first line of input contains numbers n(1 <n<1000). The next line contains a number ai (1 < ai < 10^9). Output prints a number , Number of operations .
Example
The standard input
2
1 1
standard output
0
The standard input
3
9 6 3
standard output
3
The standard input
6
1000000000 1000000000 1000000000 1000000000 1000000000 1
standard output
4999999995




Refer to the answer 1:

What does your question mean ? Yes, select the maximum value , Then delete the minimum or something ?




Refer to the answer 2:
版权声明:本文为[CSDN Q & A]所创,转载请带上原文链接,感谢。 https://pythonmana.com/2021/12/202112121828221224.html