Codeforces 768A Oath of the Night's Watch
来源:互联网 发布:js 当前页面url 编辑:程序博客网 时间:2024/05/23 21:46
——————————————————————————————————————
题目的意思是给出n个数,输出不是最大也不是最小的数的个数
排序,找出最大数个数最小数个数,总数减去就好,注意都是一样的情况
#include <iostream>#include <cstdio>#include <cstring>#include <cmath>#include <algorithm>#include <queue>#include <stack>#include <string>#include <set>#include <map>using namespace std;int a[100005];int n;int main(){ while(~scanf("%d",&n)) { for(int i=0;i<n;i++) scanf("%d",&a[i]); sort(a,a+n); if(a[0]==a[n-1]) printf("0\n"); else { int cnt=2; for(int i=1;i<n;i++) { if(a[i]==a[i-1]) cnt++; else break; } for(int i=n-2;i>0;i--) { if(a[i]==a[i+1]) cnt++; else break; } printf("%d\n",n-cnt); } } return 0;}
0 0
- Codeforces 768A Oath of the Night's Watch
- 【codeforces 768A】Oath of the Night's Watch
- Codeforces 768A Oath of the Night's Watch
- Codeforces 768A Oath of the Night's Watch
- Codeforces 768A Oath of the Night's Watch
- Codeforces 768A Oath of the Night's Watch
- Codeforces 768A Oath of the Night's Watch
- Codeforces 768A Oath of the Night's Watch
- Codeforces 768A Oath of the Night's Watch
- CodeForces 768A Oath of the Night's Watch【水题】
- A. Oath of the Night's Watch
- A. Oath of the Night's Watch
- CodeForces 731A Night at the Museum
- CodeForces 731A Night at the Museum
- CodeForces 731A-Night at the Museum
- codeforces 731A Night at the Museum
- CodeForces 731A Night at the Museum
- 【87.65%】【codeforces 731A】Night at the Museum
- Jvm原理剖析与调优之内存结构
- Atitit 遍历文件夹算法 autoit attilax总结
- Rust : 为什么没有lifetime是不行的?
- 中大双日游——GDKOI2017
- ProgressBar的圆形进度和水平进度的使用
- Codeforces 768A Oath of the Night's Watch
- D3D11地形渲染教程十九之Foliage(植被的渲染)
- HTML标签----图文详解
- 在github上fork的相关操作
- 第十七章 集合Collection 1
- Whoere即时聊天App(三)客户端实现+服务部署
- 设计模式-装饰者设计模式
- linux驱动的异步同步通知机制
- TreeSet部分源码解析