【算法题】
来源:互联网 发布:托管淘宝店铺 编辑:程序博客网 时间:2024/06/06 00:53
#include<stdio.h>#include<vector>#include <algorithm>#include <iostream>#include <functional>using namespace std;const unsigned int MAX = 100005;unsigned int n;vector<int> vec;int main(){ long long sum(0);//避免累加时溢出 scanf("%d", &n); n *= 3; vec.resize(n); register int i; for (i = 0; i < n;++i) { scanf("%d", &vec[i]); } sort(vec.begin(), vec.end(),greater<int>()); int tmp = 1; n = n / 3; for (int x = 0; x < n; ++x) { sum += vec[tmp]; tmp += 2; } cout << sum; return 0;}
阅读全文
0 0
- [算法]常见算法题
- 算法题/排序算法
- 算法题
- 算法题
- 算法题
- 算法题
- 算法题
- 算法题
- 算法题
- 算法题
- 算法题
- 算法题
- 《算法题》
- 算法题
- 算法题
- 算法题
- 算法题
- 算法题
- APP开发实战174-Android7.0的屏幕缩放功能对APP的影响
- 设置diaog.builder的透明度
- Dom4j设置编码的问题(转载)
- ubuntu下Octomap如何安装 ubuntu14.04下如何安装libqglviewer
- php环境搭建(3)----useradd
- 【算法题】
- Big Number(log10求位数)
- JS创建对象的几种方法
- 使用Python向Excel中插入图片
- 从界面获取bean的id时注意
- HDU
- java的各种集合使用
- PHP环境搭建(4)----安装php
- ssh:connect to host localhost port 22: Connection refused解决方法