POJ 3507 Judging Olympia
小技巧 判断 全部为零 用sign和所有元素依次取或
排除最大项和最小项 直接排序后取中间的四个元素
http://poj.org/problem?id=3507
1 #include <iostream>
2 #include <stdio.h>
3 #include <algorithm>
4 using namespace std;
5
6 int main()
7 {
8 freopen("in.txt", "r", stdin);
9 int a[6];
10 double sum;
11 bool sign = 0;
12 while (1)
13 {
14 sign = 0;
15 sum = 0;
16 for (int i = 0; i < 6; i++)
17 {
18 cin >> a[i];
19 sign |= a[i];
20 }
21 if (!sign) break;
22 sort(a, a+6);
23 for (int i = 1; i < 5; i++)
24 {
25 sum += a[i];
26 }
27 cout << sum / 4 << endl;
28 }
29 return 0;
30 }
POJ 3507 Judging Olympia的更多相关文章
- OJ题解记录计划
容错声明: ①题目选自https://acm.ecnu.edu.cn/,不再检查题目删改情况 ②所有代码仅代表个人AC提交,不保证解法无误 E0001 A+B Problem First AC: 2 ...
- poj 1064 (二分+控制精度) && hdu 1551
链接:http://poj.org/problem?id=1064 Cable master Time Limit: 1000MS Memory Limit: 10000K Total Submi ...
- (poj)1064 Cable master 二分+精度
题目链接:http://poj.org/problem?id=1064 Description Inhabitants of the Wonderland have decided to hold a ...
- POJ 3140.Contestants Division 基础树形dp
Contestants Division Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 10704 Accepted: ...
- 【POJ 3140】 Contestants Division(树型dp)
id=3140">[POJ 3140] Contestants Division(树型dp) Time Limit: 2000MS Memory Limit: 65536K Tot ...
- POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理
Halloween treats Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 7644 Accepted: 2798 ...
- POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理
Find a multiple Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7192 Accepted: 3138 ...
- POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治
The Pilots Brothers' refrigerator Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 22286 ...
- POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法
Flip Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 37427 Accepted: 16288 Descr ...
随机推荐
- poj 2184(dp变形,进一步加深01背包)
点击打开链接 题意: 给你n个物品,每个物品都有两个属性,s和f,要求选择一些物品,使sum(s)+sum(f)最大,并且sum(s)>=0&&sum(f)>=0, 根据0 ...
- 协作图(通信图)collaboration diagram
协作图(通信图)collaboration diagram 系列文章 [UML]UML系列——用例图Use Case [UML]UML系列——用例图中的各种关系(include.extend) [UM ...
- 利用Bootstrap框架制作查询页面的界面
UI设计实战篇——利用Bootstrap框架制作查询页面的界面 Bootstrap框架是一个前端UI设计的框架,它提供了统一的UI界面,简化了设计界面UI的过程(缺点是定制了界面,调整的余地不是太 ...
- C++11标准后的C++阅读书目
C++11标准后的C++阅读书目 投递人 itwriter 发布于 2013-09-25 19:44 评论(2) 有285人阅读 原文链接 [收藏] « » 英文原文:C++ Reading L ...
- vs2015开发Windows服务
工作已经很久,时隔这么长时间写这篇文章是给自己以后做参考.也不至于以后长时间不写Windows服务而忘记整个开发过程.windows服务开发,基础的就不说了,直接上过程. 1.新建windows服务项 ...
- 无穷字符串问题--CSDN上的面试题(原创)
网上看到一道奇怪的题,分享一下:http://hero.csdn.net/Question/Details?ID=307&ExamID=302 发布公司:CSDN 有 效 期:2014-02- ...
- D3DXCreateTextureFromFileInMemoryEx函数
注:限于翻译水平限制,详情请查阅MSDN D3DXCreateTextureFromFileInMemoryEx 函数 从内存文件创建一个纹理,这是个比D3DXCreateTextureFromFil ...
- SQL删除重复数据,保留一条
例如: id name value 1 a pp 2 a ...
- Study notes for Discrete Probability Distribution
The Basics of Probability Probability measures the amount of uncertainty of an event: a fact whose o ...
- mysql之多列索引
mysql的多列索引是经常会遇到的问题,怎样才能有效命中索引,是本文要探讨的重点. 多列索引使用的Btree,也就是平衡二叉树.简单来说就是排好序的快速索引方式.它的原则就是要遵循左前缀索引. 多个索 ...