tyvj1086 Elevator
背景
描述
输入格式
接下来N行,每行三个整数,表示H_i,A_i,C_i。
输出格式
测试样例1
输入
3
7 40 3
5 23 8
2 52 6
输出
48
备注
Vivian Snow
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
using namespace std;
int n,k,hc,h[],c[],a[],ans;
bool f[];
struct ITM{
int h;
int c;
int a;
}temp;
bool cmp(ITM x,ITM y){
return x.a < y.a;
}
vector<ITM> itm;
int main(){
cin>>n;
for(int i = ;i <= n;i++){
scanf("%d%d%d",&h[i],&a[i],&c[i]);
k = ;
while(c[i] >= k){
temp.a = a[i];
temp.c = k;
temp.h = h[i];
c[i] -= k;
k <<= ;
itm.push_back(temp);
}
if(c[i]){
temp.a = a[i];
temp.c = c[i];
temp.h = h[i];
itm.push_back(temp);
}
}
sort(itm.begin(),itm.end(),cmp);
n = itm.size();
f[] = true;
for(int i = ;i < n;i++){
hc = itm[i].h*itm[i].c;
for(int j = itm[i].a;j >= itm[i].h;j--){
if(f[j-hc]) f[j] = true;
if(f[j]) ans = max(ans,j);
}
}
cout<<ans;
return ;
}
tyvj1086 Elevator的更多相关文章
- HDOJ 1008. Elevator 简单模拟水题
Elevator Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Su ...
- poj[2392]space elevator
Description The cows are going to space! They plan to achieve orbit by building a sort of space elev ...
- Design Elevator
From: https://discuss.leetcode.com/topic/89/write-elevator-program-using-event-driven-programming/9 ...
- PAT (Advanced Level) Practise:1008. Elevator
[题目链接] The highest building in our city has only one elevator. A request list is made up with N posi ...
- Pair Project: Elevator Scheduler [电梯调度算法的实现和测试]
作业提交时间:10月9日上课前. Design and implement an Elevator Scheduler to aim for both correctness and performa ...
- POJ2392Space Elevator(贪心+背包)
Space Elevator Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 9970 Accepted: 4738 De ...
- hdu 1008 Elevator
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Description The hig ...
- 【ACM】HDU1008 Elevator 新手题前后不同的代码版本
[前言] 很久没有纯粹的写写小代码,偶然想起要回炉再来,就去HDU随便选了个最基础的题,也不记得曾经AC过:最后吃惊的发现,思路完全不一样了,代码风格啥的也有不小的变化.希望是成长了一点点吧.后面定期 ...
- Elevator 分类: HDU 2015-06-19 21:52 13人阅读 评论(0) 收藏
Elevator Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Subm ...
随机推荐
- php 获取当前服务器 系统
引子: 今天遇到一个问题,当执行文件操作是,不同系统之间的命令是不同的 , 所以需要判断当前系统. $is_win = strtoupper(substr(PHP_OS,0,3))==='WIN'?1 ...
- java基础算法之选择排序
选择排序 选择排序(Selection sort)是一种简单直观的排序算法.它的工作原理是每一次从待排序的数据元素中选出最小(或最大)的一个元素,存放在序列的起始位置,直到全部待排序的数据元素排完. ...
- [No000089]String的(补空位)左对齐,(补空位)右对齐
using System; namespace Chinese中文排序Sort { internal class Program { /// <summary> /// 取子字符串 /// ...
- android:exported 属性详解
属性详解 标签: android 2015-06-11 17:47 27940人阅读 评论(7) 收藏 举报 分类: Android(95) 项目点滴(25) 昨天在用360扫描应用漏洞时,扫描结果, ...
- eclipse自动提示功能没了的解决办法(转载)
eclipse自动提示功能没了的解决办法 标签: eclipse联想 2012-08-09 14:32 24687人阅读 评论(7) 收藏 举报 分类: Android(38) 版权声明:本文为博 ...
- EasyUI实现工地领款单项目
环境搭建 引入jar.配置Spring MVC.web.xml.日志等 建表 自动生成MyBatis相关文件 mybatis-generator-core-1.3.2.jar <?xml ver ...
- 【腾讯GAD暑期训练营游戏程序班】游戏中的特效系统作业说明文档
- LeetCode-66-Plus One
Given a non-negative number represented as an array of digits, plus one to the number. The digits ar ...
- HTTP协议(二):header标头说明
Header 解释 示例 Accept-Ranges 表明服务器是否支持指定范围请求及哪种类型的分段请求 Accept-Ranges: bytes Age 从原始服务器到代理缓存形成的估算时间(以秒计 ...
- Asp.Net 自定义储存Session方式
介绍 由于针对于自定义Session存储方式比较少,所以整理了使用自定义Session的方式.用于构建自定义会话存储提供程序代码,而不是使用默认的 SessionStore 介绍 背景 本文使用的是m ...