#includeusing namespace std;int n, i, temp, sum, a[100];int main(){\tcin>>n;\tfor (i = 1; i <= n; i ) \t\tcin>>a[i];\tfor (i = 1; i <= n - 1; i ) \t\tif (a[i] > a[i 1]) {\t\t\ttemp = a[i]; \t\t\ta[i] = a[i 1]; \t\t\ta[i 1] = temp;\t\t}\tfor (i = n; i >= 2; i--)\t\tif (a[i] < a[i - 1]) { \t\t\ttemp = a[i];\t\t\ta[i] = a[i - 1];\t\t\ta[i - 1] = temp;\t\t}\tsum = 0;\tfor (i = 2; i <= n - 1; i ) \t\tsum = a[i];\tcout< 输入:
8
40 70 50 70 20 40 10 30
输出:
发表评论 取消回复