B. Pashmak and Flowers
来源:互联网 发布:知定静安虑得七境解读 编辑:程序博客网 时间:2024/05/21 06:23
/* 题目有点要注意,在初始话max,min时要设置改类型的最大最小。测试数据里就用边界卡人。。。*/#include<iostream>#include<cmath>#include<algorithm> #include<cstdio>using namespace std;int main (){long long int n,max,min,ans1,ans2;int u,d,i,j,a;while(cin>>n){u=0;d=0;max=0;min=9223372036854775807; // 第一次写的时候写错了。。。。。for(i=1;i<=n;i++){scanf("%d",&a);if(a>max){max=a;u=0;}if(a<min){min=a;d=0;}if(a==max)u++;if(a==min)d++;}ans1=max-min;if(max==min){if(n%2==0)ans2=(n/2)*(n-1);elseans2=n*((n-1)/2);}elseans2=d*u;cout<<ans1<<" "<<ans2<<endl;}return 0;}//-----------------------------------------华丽的分割线-----------------------------------------------unsigned int 0~4294967295 10^10int 2147483648~2147483647 10^9unsigned long 0~4294967295 10^10long -2147483648~2147483647 10^9long long的最大值: 9223372036854775807 10^19long long的最小值: -9223372036854775808 10^19unsigned long long的最大值: 18446744073709551615 10^20__int64的最大值: 9223372036854775807 10^19__int64的最小值: -9223372036854775808 10^19unsigned __int64的最大值: 18446744073709551615 10^20
0 0
- B. Pashmak and Flowers
- B. Pashmak and Flowers
- B. Pashmak and Flowers
- 459B Pashmak and Flowers
- 【CODEFORCES】 B. Pashmak and Flowers
- #261B. 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
- cf459B Pashmak and Flowers
- 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
- java log view
- Android应用程序调式——无线调试
- spark RDD 详解
- Eclipse 快捷键
- POJ 2395 Out of Hay
- B. Pashmak and Flowers
- QT自定义精美换肤界面
- java中volatile关键字的含义
- 不规则截图的实现
- 在RHEL6.4下安装Adobe Media Server 5
- linux下安装matlab(针对64位系统)方法
- poj 2352 Stars
- android sensors 总结(三)
- sql语句优化原则