NBUT 1115 Cirno's Trick (水)
题意:
给出多个double数,去掉其最小的和最大的,再对余下的求均值。
思路:
再输入时将最大和最小去掉,顺便统计非最值的和,输出时除一下个数即可。
#include <bits/stdc++.h>
using namespace std; int main()
{
//freopen("input.txt", "r", stdin);
int n;
while(~scanf("%d",&n))
{
if(n==)
{
cout<<"0.00"<<endl;
continue;
}
double small, big;
cin>>small>>big;
if(small>big) swap(small,big);
double ans=0.0, tmp=0.01; for(int i=; i<n-; i++)
{
cin>>tmp;
if(tmp<small)
{
ans+=small;
small=tmp;
}
else if(tmp>big)
{
ans+=big;
big=tmp;
}
else ans+=tmp;
}
printf("%.2f\n",ans/(n-));
} return ;
}
AC代码
NBUT 1115 Cirno's Trick (水)的更多相关文章
- CodeForces 221(div 2)
A 无trick水题... /* * Author: Plumrain * Created Time: 2013-12-24 22:26 * File Name: B.cpp */ #include ...
- sublime Text3 实现2:1:1三分屏效果
小trick, 水一篇博客 先上效果图 由于写题啥的时候需要重定向输入输出改数据对拍, 设置成这样的效果就非常直观的看数据 直接切题, 首选项--快捷键--default里搜索alt+shift+1( ...
- NBUT 1186 Get the Width(DFS求树的宽度,水题)
[1186] Get the Width 时间限制: 1000 ms 内存限制: 65535 K 问题描述 It's an easy problem. I will give you a binary ...
- ACM: NBUT 1105 多连块拼图 - 水题 - 模拟
NBUT 1105 多连块拼图 Time Limit:1000MS Memory Limit:65535KB 64bit IO Format: Practice Appoint ...
- NBUT 1122 Shameimaru's Candid Camera(水)
题意: 给n*m个格子,初始时每个格子中有个数值为0,部分格子中含有炸弹,每个炸弹爆炸可以将周围的8个非炸弹格子中的数值加1,求全部炸弹炸完后那些非0且非炸弹格子中的数是多少. 思路: 另开一个矩阵, ...
- Ikki's Story IV - Panda's Trick POJ - 3207(水2 - sat 在圈内 还是 在圈外)
题意: 就是一个圈上有n个点,给出m对个点,这m对个点,每一对都有一条边,合理安排这些边在圈内或圈外,能否不相交 解析: 我手残 我手残 我手残 写一下情况 只能是一个在圈外 一个在圈内 即一个1一个 ...
- Codeforces Round #396 (Div. 2) A B C D 水 trick dp 并查集
A. Mahmoud and Longest Uncommon Subsequence time limit per test 2 seconds memory limit per test 256 ...
- NBUT 1118 Marisa's Affair (排序统计,水)
题意: 每行给出一个人名和一个int值,人名可重复出现.要求对同一个人名统计int值,最大的先输出,若相同,则按照人名出现次数,若再相同,则按照人名字典序. 思路: 输入完全部进行排序,写个比较函数传 ...
- NBUT 1114 Alice's Puppets(排序统计,水)
题意:给一棵人名树,按层输出,同层则按名字的字典序输出. 思路:首先对每个人名做索引,确定其在哪一层,按层装进一个set,再按层输出就自动排好序了. #include <bits/stdc++. ...
随机推荐
- Windows服务卸载服务窗口仍显示的问题
关于Windows服务通过命令卸载后, 打开服务窗口,服务还有显示,只是状态改为了禁用,运行停止.那么我们怎么解决呢, 不要心慌,打开你的任务管理器,查看服务所用的exe程序是否还在运行,若有的话,便 ...
- .pdm文件怎么打开
1. 用PowerDesigner打开.pdm文件
- PICO 中关于时基ps3000aGetTimebase函数介绍
- CF-798B
B. Mike and strings time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- mysql的权限问题SQLException: access denied for @'localhost' (using password: no)
遇到了 SQLException: access denied for @'localhost' (using password: no) 解决办法 grant all privileges o ...
- 336. Palindrome Pairs(can't understand)
Given a list of unique words, find all pairs of distinct indices (i, j) in the given list, so that t ...
- nginx 一些配置
worker_processes 4; #工作进程数 events { #epoll是多路复用IO(I/O Multiplexing)中的一种方式, #仅用于linux2.6以上内核,可以大大提高ng ...
- 关于maven+springmvc+mybits搭建的框架clean,build后错误:org.apache.ibatis.binding.BindingException的处理
1.错误原型截图: 2.我对错误的处理轨迹: a.首先,可能是我的mapper.xml配置错了,但是经过查看发现mybits.xml配置如下: 我项目的目录结构如下: 初次判断mybits的配置没有问 ...
- Codeforces 1106F(数论)
要点 998244353的原根g = 3,意味着对于任意\[1 <= x,y<p\]\[x\neq\ y\]\[g^x\%p\neq\ g^y\%p\]因此可以有构造序列\(q(a)与a一 ...
- 最大xor,and,or
http://210.33.19.103/contest/998 and,or部分 并不用01trie,题目&题解:https://blog.csdn.net/dreaming__ldx/ar ...