#include
using namespace std;
int main() {
int a[1000000], n, zdz = 0, zdzwz = 0, zxz = 0, zxzwz = 0;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
if (zdz < a[i]) {
zdz = a[i];
zdzwz = i;
}
if (zxz > a[i]) {
zxz = a[i];
zxzwz = i;
}
}
cout << zxz << " " << zxzwz << " " << zdz << " " << zdzwz;
return 0;
}
共 1 条回复
初始化错了,最好用 a[1] 当最小值和最大值的初始值。