#include<iostream>
using namespace std;
int main()
{
int a[1010],n;
cin>>n;
for(int i=1;i<=n;i++) cin>>a[i];
//1
int sum=0;
for(int i=1;i<=n;i++) sum+=a[i];
cout<<sum<<endl;
//2
for(int i=n;i>=1;i--) cout<<a[i]<<" ";
cout<<endl;
//3
int max=a[1],maxi=1;
for (int i=2;i<=n;i++)
{
if (a[i]>max)
{
max=a[i];
maxi=i;
}
}
cout<<max<<" "<<maxi<<endl;
//4
int min=a[1],mini=1;
for (int i=2;i<=n;i++)
{
if (a[i]<=min)
{
min=a[i];
mini=i;
}
}
cout<<min<<" "<<mini<<endl;
return 0;
}
共 2 条回复
呵呵呵呵