CCF 201903-1 小中大
作者:互联网
#include <iostream> #include <cstring> #include <cstdio> #include <algorithm> #define mem(a,b) memset(a,b,sizeof(a)); using namespace std; typedef long long ll; const int maxn = 500005; const ll INF = 0x3f3f3f3f; int main() { int n; int a[100005]; scanf("%d",&n); for(int i = 1; i <= n; i++) { scanf("%d",&a[i]); } sort(a+1,a+1+n); int mmin = a[1], maxn = a[n]; double mid; if(n % 2 == 0) { mid = (a[n/2+1]+a[n/2])*1.0/2; } else { mid = a[n/2+1]; } if(mid == (int)mid) printf("%d %.0lf %d\n",maxn,mid,mmin); else printf("%d %.1lf %d\n",maxn,mid,mmin); return 0; }
注意输出格式
标签:CCF,小中大,int,ll,memset,long,201903,const,include 来源: https://www.cnblogs.com/LLLAIH/p/11333154.html