;'.'

yanqiao 2019-08-21 14:53:07 6
{{ vote && vote.total.up }}

共 1 条回复

HJC 黑铁V

#include <bits/stdc++.h>

using namespace std; int a[100005]; int main() { int i, c, d, f, h = 0, j = 0; cin >> c; for (i = 1; i <= c; i++) cin >> a[i]; f = a[1]; for (i = 2; i <= c; i++) { if (a[i] > f) { f = a[i]; } h = i; } d = a[1]; for (i = 2; i >= 1; i--) { if (a[i] < d) { d = a[i]; j = i; } } cout <<" "<< d << " " << j << " " << f << " " << h << endl; return 0; }