提交时间:2026-01-16 18:36:58
运行 ID: 82646
#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int s[n],t[n]; for(int x=0;x<n;++x){ cin>>s[x]; t[x]=s[x]; } sort(s,s+n); for(int y=0;y<n;++y){ if(t[y]==s[0]) const int b=y; if(t[y]==s[n-1]) const int a=y; } cout<<"max="<<s[n-1]<<" ("<<a<<")"<<endl; cout<<"min="<<s[0]<<" ("<<b<<")"; return 0; }