ZOJ-2488 Rotten Ropes
来源:互联网 发布:对象数组初始化 编辑:程序博客网 时间:2024/05/20 04:14
对每个绳子(承受力n)找出比它承受力大的绳子的个数m,则棍子重量 = n * m, 求出最大值即可.
#include <iostream>#include <cstdio>#include <algorithm>#include <cstring>#include <vector>#include <climits>using namespace std;int num[1005];int main(){ // freopen("in.txt", "r", stdin); int t; cin >> t; while(t--) { int n; cin >> n; for(int i = 0; i < n; i++) cin >> num[i]; sort(num, num+n); int maxs = 0; for(int i = 0; i < n; i++) { maxs = max(maxs, (n-i)*num[i]); } cout << maxs << endl; } return 0;}
0 0
- zoj 2488 Rotten Ropes
- ZOJ 2488 Rotten Ropes
- ZOJ-2488 Rotten Ropes
- zoj 2488 || poj 2291 Rotten Ropes
- Rotten Ropes
- 2291 Rotten Ropes
- hdu——Rotten Ropes
- POJ 2291 Rotten Ropes G++
- UVa10985 Rings'n'Ropes
- Chain the Ropes
- Tokyo Westerns/MMA CTF - Rotten Uploader
- ZOJ-2488
- Ropes:an alternative to strings
- uva 10952 Rings'n'Ropes
- 1125. Chain the Ropes (25)
- PAT--1125. Chain the Ropes
- 1125. Chain the Ropes 解析
- PAT A1125 Chain the Ropes
- Minimum Depth of a Binary Tree
- jquery学习笔记之动态添加元素绑定事件
- Linux基础笔试知识点
- 一个小画板(使用canvas)
- 内存管理相关
- ZOJ-2488 Rotten Ropes
- Java四种线程池
- 机器学习之路——多重共线性
- java中新建对象的五种方式
- bzoj2330 SCOI2011糖果 查分约束系统
- codewars上的一个小例子
- Mysql innodb 间隙锁
- Eclipse对Android项目导入、导出、修改工程名详解
- POJ 1741 Tree [树上点分治]