小技巧 判断 全部为零 用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的更多相关文章

  1. OJ题解记录计划

    容错声明: ①题目选自https://acm.ecnu.edu.cn/,不再检查题目删改情况 ②所有代码仅代表个人AC提交,不保证解法无误 E0001  A+B Problem First AC: 2 ...

  2. poj 1064 (二分+控制精度) && hdu 1551

    链接:http://poj.org/problem?id=1064 Cable master Time Limit: 1000MS   Memory Limit: 10000K Total Submi ...

  3. (poj)1064 Cable master 二分+精度

    题目链接:http://poj.org/problem?id=1064 Description Inhabitants of the Wonderland have decided to hold a ...

  4. POJ 3140.Contestants Division 基础树形dp

    Contestants Division Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 10704   Accepted:  ...

  5. 【POJ 3140】 Contestants Division(树型dp)

    id=3140">[POJ 3140] Contestants Division(树型dp) Time Limit: 2000MS   Memory Limit: 65536K Tot ...

  6. POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理

    Halloween treats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7644   Accepted: 2798 ...

  7. POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理

    Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7192   Accepted: 3138   ...

  8. POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治

    The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22286 ...

  9. POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法

    Flip Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 37427   Accepted: 16288 Descr ...

随机推荐

  1. c/c++操作访问数据,是堆中的数据快还是栈中的数据快

    这里的问题其实问的是对堆与栈的数据访问有什么不同. 观察如下代码: #include<stdio.h> #include<iostream> using namespace s ...

  2. [Usaco2008 Mar]Cow Travelling游荡的奶牛[简单DP]

    Description 奶牛们在被划分成N行M列(2 <= N <= 100; 2 <= M <= 100)的草地上游走,试图找到整块草地中最美味的牧草.Farmer John ...

  3. github开源项目

    开源一小步,前端一大步   作为一名前端攻城狮,相信不少人已经养成了这样的习惯.当你进入一个网站,总会忍不住要打开控制台看下它是如何布局的,动画是如何实现的等.这也是前端开发者一个不错的的学习途径. ...

  4. 需要我们了解的SQL Server阻塞原因与解决方法

    需要我们了解的SQL Server阻塞原因与解决方法 上篇说SQL Server应用模式之OLTP系统性能分析.五种角度分析sql性能问题.本章依然是SQL性能 五种角度其一“阻塞与死锁” 这里通过连 ...

  5. network重启失败原因

    /etc/sysconfig/network-scripts/ifcfg-eth0   DEVICE='eth0'  eth0后面千万不能加空格之类的  

  6. LearnCpp.com

    LearnCpp.com is a totally free website devoted to teaching you to program in C++. Whether you’ve had ...

  7. QT QTextBrowser

    1.0 MainWindow.h #ifndef MAINWINDOW_H #define MAINWINDOW_H #include<QMainWindow> #include<Q ...

  8. 使用IDEA开发

    IDEA 在使用IDEA之前,我是eclipse的忠实用户.无论是最初学习java,还是后来用python/golang. eclipse丰富的插件已经满足了我大部分的使用,直到在师弟的大力推荐下使用 ...

  9. angularJS自定义 过滤器基础

    先写个简单的例子,该过滤器是指定规定的字符串长度: html: <div ng-app="app" ng-controller="ctrl"> &l ...

  10. github 自学文档 希望可以给初学的人一些帮助

    一 .git的安装 windows下面的安装:https://git-for-windows.github.io  从这里下载完全无脑安装. 安装完成后,在开始菜单里找到"Git" ...