小技巧 判断 全部为零 用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. Love myself...

    Sometimes we feel as if our lives rely on that one person. We think 'If I do this, he/she will like ...

  2. 一、SOAP简单对象访问协议讲解

    一.SOAP简单对象访问协议讲解 今天给大家讲讲SOAP的基本知识.下节给大家演示创建基于SOAP的Web Service. 更多SOA文章请查看我的个人博客. 首先,让我来简单一下入门SOAP所需的 ...

  3. 2013.2.A&&3.A

    半期考之后,磨磨蹭蹭的刷了两套长乐的模拟题[=-=我现在实在是不敢恭维自己的刷题速度]感觉貌似很久没有来这里喂食了,就顺便yy下题解好了 2013.2.A: ice :BFS和spfa都可以,我打了个 ...

  4. [转]Introduction to Core Bluetooth: Building a Heart Rate Monitor

    ref:http://www.raywenderlich.com/52080/introduction-core-bluetooth-building-heart-rate-monitor The C ...

  5. IOS7学习之路二(处理ios6到ios7后UITableView的两个显示问题)

    1.在ios6开发的项目,当用ios7的虚拟机显示的时候会出现UINavigationItem遮挡TableView的问题: 下面是对比显示效果: 我的处理方法是: 在UITableViewContr ...

  6. iOS多线程的初步研究

    iOS多线程的初步研究(四) 理解run loop后,才能彻底理解NSTimer的实现原理,也就是说NSTimer实际上依赖run loop实现的. 先看看NSTimer的两个常用方法: + (NST ...

  7. JavaScript正则表达式的坑很深

    Javascript的正则表达式,不能不说方便,简简单单“//”就可以声明一个RegExp对象,配合编辑器的颜色渲染,实在让人舒心.但过于方便的东西,必然也会有一些瑕疵需要我们去注意. 首先要说的是使 ...

  8. .net中获取图像缩略图的函数GetThumbnailImage

    关于.net中获取图像缩略图的函数GetThumbnailImage的一些认识. 在很多图像软件中,打开一幅图像的时候都会显示其缩略图,在看图软件中这样的需求更为常见.如何快速的获取缩略图的信息并提供 ...

  9. Internet Liberity -- a specific anonymous internet guide

    Here we see. Please leave your comments if you have some views. Happy hacking! Free the internet!

  10. Organic Solar Cells - Theory and Practice

    renewable engergy: Wind solar Tidal Wave Ocean Bio Etc. How much energy we gonna need as following y ...