#include <bits/stdc++.h> using namespace std; int main() { int n;cin>>n; int maxNum=INT_MIN, minNum=INT_MAX, index=0, maxIndex=-1, minIndex=-1, temp; vector<int>v; while(n--){ cin>>temp; if(temp>maxNum){ maxNum = temp; maxIndex = index; } if(temp<minNum){ minNum = temp; minIndex = index; } v.push_back(temp); index++; } swap(v[maxIndex],v[minIndex]); for(auto a:v) cout<<a<<" "; } // 64 位输出请用 printf("%lld")
qd