#261B. Pashmak and Flowers
来源:互联网 发布:现货分时指标公式源码 编辑:程序博客网 时间:2024/06/08 01:04
注n 也应该是long long 类型的。#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<vector>
#include<cmath>
#include<stdlib.h>
#include<iomanip>
#include<list>
#include<deque>
#include<map>
#include <stdio.h>
#include <queue>
#define maxn 10000+5
#define ull unsigned long long
#define ll long long
#define reP(i,n) for(i=1;i<=n;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define cle(a) memset(a,0,sizeof(a))
#define mod 90001
#define PI 3.141592657
#define INF 1<<30
const ull inf = 1LL << 61;
const double eps=1e-5;
using namespace std;
bool cmp(int a,int b){
return a>b;
}
ll a[200005];
int main()
{
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
ll n;
cin>>n;
ll Max=-1,Min=INF;
for(int i=1;i<=n;i++)
{
scanf("%d",&a[i]);
if(Max<a[i])
{
Max=a[i];
}
if(Min>a[i])
{
Min=a[i];
}
}
if(Max==Min) printf("%I64d %I64d\n",Max-Min,n*(n-1)/2);
else{ll m=0,p=0;
for(int i=1;i<=n;i++)
{
if(a[i]==Min)m++;
if(a[i]==Max)p++;
}
printf("%I64d %I64d\n",Max-Min,m*p);
}
return 0;
}
- #261B. Pashmak and Flowers
- B. Pashmak and Flowers
- B. Pashmak and Flowers
- B. Pashmak and Flowers
- 459B Pashmak and Flowers
- 【CODEFORCES】 B. Pashmak and Flowers
- Codeforces Round #261 (Div. 2)B. Pashmak and Flowers
- Codeforces #261 (Div. 2)B. Pashmak and Flowers
- Codeforces Round #261 (Div. 2) B.Pashmak and Flowers
- Codeforces Round #261 (Div. 2) B. Pashmak and Flowers【水】
- Codeforces Round #261 (Div. 2) B. Pashmak and Flowers
- Codeforces Round #261 (Div. 2)B. Pashmak and Flowers
- Codeforces Round #261 (Div. 2) B. Pashmak and Flowers 水题
- Codeforces 459B Pashmak and Flowers(水题)
- CodeForces 459B. Pashmak and Flowers
- Codeforces 459B Pashmak and Flowers
- CodeForces 459B Pashmak and Flowers
- codeforces 459B Pashmak and Flowers
- Centos6.7 安装Sublime text 3
- CF 261A. Pashmak and Garden
- #274B. Towers
- #274A. Expression
- 文件加密
- #261B. Pashmak and Flowers
- UVa100 The 3n + 1 problem
- 【BZOJ1011】遥远的行星
- UVa-11292 -Dragon of Loowater
- UVa11729 Commando War
- JZOJ4446【HNOI模拟】B
- hiho #1015 : KMP算法
- HDU 2952 Counting Sheep
- andorid 图片加载总结