小技巧 判断 全部为零 用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#自定义配置文件节点

    老实说,在以前没写个自定义配置节点之前,我都是写到一个很常用的节点里面,就是appSettings里add,然后再对各个节点的value值进行字符串分割操作,根据各种分割字符嵌套循环处理,后来看到一些 ...

  2. 【ios开发】ios开发问题集锦

    1. ARC forbids explicit message send of'release' 'release' is unavailable: not available inautomatic ...

  3. vijos1004 博弈论

    一道挺简单的博弈论题 感觉自己也没有很规范的学过博弈论吧,就是偶尔刷到博弈论的题目,感受一下推导的过程,大概能领悟些什么 我们设2001.11.4必败,推上去,即2001.10.4和2001.11.3 ...

  4. tortoiseSVN 设置ignore

      *.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo *.rej *~ #*# .#* .*.swp .DS_Store *.dll ...

  5. jquery数据验证插件

    jquery数据验证插件(自制,简单,练手)   一:最近项目中js数据验证比较多,为了统一风格,移植复用,于是顺手封装了Jquery的插件. (function($) { var defaults ...

  6. python(学习之路一)

    ''' Created on 2013-5-3 @author: lixingle ''' #输出的练习 length=3 width=4; area=length*width print(area) ...

  7. [转]浅谈PCA的适用范围

    线性代数主要讲矩阵,矩阵就是线性变换,也就是把直线变成直线的几何变换,包括过原点的旋转.镜射.伸缩.推移及其组合.特征向量是对一个线性变换很特殊的向量:只有他们在此变换下可保持方向不变,而对应的特征值 ...

  8. CVPR 2013

    CVPR2013大部分文章都已经公开了,大家可以通过下面的网址访问: http://www.cv-foundation.org/openaccess/CVPR2013.py# 还有一篇根据CVPR20 ...

  9. xls===>csv tables===via python ===> sqlite3.db

    I've got some files which can help a little bit to figure out where people are from based on their I ...

  10. API接口服务端

    <?php /** * API接口服务端 * * */ require 'mysql_class.php'; header('Content-Type:text/html;charset=utf ...