H - Pashmak and Flowers
作者:互联网
翻译:
#include <iostream>
#include <string.h>
#include <algorithm>
const int N=2e5+5;
using namespace std;
int main()
{
int n,a[N],b,t;
int sum1=0,sum2=0;
cin>>n;
for(int i=0;i<n;i++)
cin>>a[i];
sort(a,a+n);
if(a[0]==a[n-1])
cout<<"0"<<' '<<(long long)n*(n-1)/2<<endl;
else
{
for(int i=0;i<n;i++)
{
if(a[i]==a[0])
sum1++;
if(a[i]==a[n-1])
sum2++;
}
cout<<a[n-1]-a[0]<<' '<<(long long)sum1*sum2<<endl;
}
return 0;
}
标签:Flowers,cout,int,sum2,sum1,++,Pashmak,include 来源: https://blog.csdn.net/weixin_51713993/article/details/114033283