我哪里错了

tctm169 杀手 2024-09-01 9:15:47 4

#include <bits/stdc++.h> #include #include #include #include #include #include using namespace std; long long int b[100005], a[100005]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; b[i] = a[i]; } long long int x, y, z; sort(a + 1, a + 1 + n); for (int i = 1; i <= n; i++) { x = a[1]; y = a[n]; break; } for (int i = 1; i <= n; i++) { if (b[i] == x) { cout << b[i] << " " << i << " "; } continue; } for (int i = n; i >= 1; i--) { if (y == b[i]) { cout << y << " " << i; return 0; } }

return 0;

}

{{ vote && vote.total.up }}