Problem 1274 - 可怜的lpx
接下来n个整数Xi,代表第i根木棍的长为Xi (1<=Xi<=10^6)。
1 2 3 4
#include <iostream>
#include <stdio.h>
#include <queue>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <stack>
#include <math.h>
#define Max(a,b) ((a)>(b)?(a):(b))
#define Min(a,b) ((a)<(b)?(a):(b))
using namespace std ;
typedef long long LL ;
const int Max_N= ;
int N ,num[Max_N] ;
int cmp(int a ,int b){
return a>b ;
}
inline int ok(int a ,int b ,int c){
return b+c>a ;
}
int gao(){
int i= ;
while(i<=N-){
if(ok(num[i],num[i+],num[i+]))
return num[i]+num[i+]+num[i+] ;
i++ ;
}
}
int main(){
while(scanf("%d",&N)!=EOF){
for(int i= ;i<=N; i++)
scanf("%d",&num[i]) ;
sort(num+,num++N,cmp) ;
printf("%d\n",gao()) ;
}
return ;
}
Problem 1274 - 可怜的lpx的更多相关文章
- [题解]poj 1274 The Perfect Stall(网络流)
二分匹配传送门[here] 原题传送门[here] 题意大概说一下,就是有N头牛和M个牛棚,每头牛愿意住在一些牛棚,求最大能够满足多少头牛的要求. 很明显就是一道裸裸的二分图最大匹配,但是为了练练网络 ...
- [题解]poj 1274 The Prefect Stall
Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 22736 Accepted: 10144 Description Far ...
- poj 1274 The Perfect Stal - 网络流
二分匹配传送门[here] 原题传送门[here] 题意大概说一下,就是有N头牛和M个牛棚,每头牛愿意住在一些牛棚,求最大能够满足多少头牛的要求. 很明显就是一道裸裸的二分图最大匹配,但是为了练练网络 ...
- poj 1274 The Prefect Stall - 二分匹配
Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 22736 Accepted: 10144 Description Far ...
- hdoj 2102 A计划
A计划 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submiss ...
- hdu 2102 A计划(双层BFS)(具体解释)
转载请注明出处:http://blog.csdn.net/u012860063?viewmode=contents 题目链接:http://acm.hdu.edu.cn/showproblem.php ...
- A计划(bfs)
A计划 Time Limit : 3000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Submissio ...
- HDU 2102 A计划(DFS)
题目链接 Problem Description 可怜的公主在一次次被魔王掳走一次次被骑士们救回来之后,而今,不幸的她再一次面临生命的考验.魔王已经发出消息说将在T时刻吃掉公主,因为他听信谣言说吃公主 ...
- A计划
A计划 Time Limit : 3000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Submissio ...
随机推荐
- $_SERVER 相关变量
PHP编程中经常需要用到一些服务器的一些资料,特把$_SERVER的详细参数整理下,方便以后使用. $_SERVER['PHP_SELF'] #当前正在执行脚本的文件名,与 document root ...
- [转] Neutron FWaaS
OpenStack Neutron FWaaS 学习 ( by quqi99 ) 作者:张华 发表于:2013-06-24 版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息 ...
- memcache 永久数据被踢
1.memcache的slab chunk 就像公交车的坐位一样,有大小之分,还有活跃的状态. 2.代码 index.php -->插入数据,注意$value的大小和重复次数,跟chunk和其数 ...
- DatagridView 最后编辑状态数据无法自动提交的问题
DataGridView1.CurrentCell = null 从一个帖子上看的,绝招! http://bbs.csdn.net/topics/120020614
- 23. Merge k Sorted Lists
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. = ...
- C++11的新类型转换方法
转载自 http://blog.csdn.net/luoweifu/article/details/20493177 基于C++11标准 如果你用的编译器是基于最新的C++11标准,那么这个问题就变的 ...
- Oracle-decode函数
decode函数 简单例子:管理员登录Oracle select sid, username, decode(command, 0, 'None', 2, 'Insert', 3, 'Select', ...
- 转-ListView的性能优化之convertView和viewHolder
ListView的性能优化之convertView和viewHolder 2014-05-14 参考:http://www.cnblogs.com/xiaowenji/archive/2010/12/ ...
- 30天轻松学习javaweb_模拟tomcat
运行 javac Server.java 编译java文件 执行 java Server 运行程序 在ie中输入 http://localhost:9999/ 打开模拟的服务程序 import jav ...
- ubuntu 允许端口被连接
iptables -I INPUT -p tcp --dport 3306 -j ACCEPT 推荐一个自己业余时间开发的网盘搜索引擎,360盘搜(www.360panso.com)