想请教一下大佬们,这道csp小中大我为什么只有85分呢
#include<iostream>
using namespace std;
int main(){
int n,i,a,b;
float c;
cin>>n;
int x[n];
for(i=0;i<n;i++)
cin>>x[i];
for(i=0;i<n;i++)
{if(x[0]>x[n-1])
{a=x[0];b=x[n-1];}
else{a=x[n-1];b=x[0];}
}
if(n%2)
{c=x[n/2];cout<<a<<" "<<c<<" "<<b<<endl;
}
else {c=(x[n/2]+x[n/2-1])/2;
if((x[n/2]+x[n/2-1])%2)
{cout<<a<<" "<<c<<".5 "<<b<<endl;}
else cout<<a<<" "<<c<<" "<<b<<endl;
}
return 0;
}
|
|