Zhenya moves from the dormitory

题目链接:

http://acm.hust.edu.cn/vjudge/contest/126546#problem/D

Description


After moving from his parents’ place Zhenya has been living in the University dormitory for a month.
However, he got pretty tired of the curfew time and queues to the shower room so he took a fancy for
renting an apartment. It turned out not the easiest thing in the world to make a choice. One can live in
a one bedroom apartment or in a two bedroom apartment, alone or share it with a friend. Zhenya can
afford to rent an apartment of any type alone, but he can share only a two bedroom apartment. If two
people share an apartment, each pays half of the rent. Every apartment has its own advantages like part
of the town, floor, view from the windows, etc., which Zhenya is going to take into account to make a
decision.
Besides that, his friends, he’s ready to share an apartment with, also have certain advantages. For example,
Igor is a good cook, Dima is tidy, Kostya is a good cook and at the same time can explain how to solve
functional analysis problems. And do not forget that living alone has its own bright sides.
Zhenya has already prepared the list of suitable apartments and possible housemates. Zhenya has estimated
in units the advantages of each apartment and each friend and also the advantages of living alone. Besides,
he knows the maximum sum of money he and each of his friends is ready to pay for the apartment. Help
Zhenya to make a decision.

Input


The first line contains three integers: the maximum sum Zhenya is ready to pay monthly, the advantages of
living alone in a one bedroom apartment and the advantages of living alone in a two bedroom apartment.
The second line contains an integer

Gym 100507D Zhenya moves from the dormitory (模拟)的更多相关文章

  1. ural 2015 Zhenya moves from the dormitory(模拟)

    2015. Zhenya moves from the dormitory Time limit: 1.0 secondMemory limit: 64 MB After moving from hi ...

  2. Gym 100507C Zhenya moves from parents (线段树)

    Zhenya moves from parents 题目链接: http://acm.hust.edu.cn/vjudge/contest/126546#problem/C Description Z ...

  3. D - Zhenya moves from the dormitory URAL - 2015

    After moving from his parents’ place Zhenya has been living in the University dormitory for a month. ...

  4. 【线段树】Gym - 100507C - Zhenya moves from parents

    线段树每个结点维护两个值,分别是这个区间的 负债 和 余钱. 按时间顺序从前往后看的时候,显然负债是单调不减的. 按时间顺序从后往前看的时候,显然余钱也是单调不减的,因为之前如果有余钱,可能会增加现在 ...

  5. ural2014 Zhenya moves from parents

    Zhenya moves from parents Time limit: 1.0 secondMemory limit: 64 MB Zhenya moved from his parents’ h ...

  6. ural 2014 Zhenya moves from parents

    2014. Zhenya moves from parents Time limit: 1.0 secondMemory limit: 64 MB Zhenya moved from his pare ...

  7. zhenya moves from parents

    Zhenya moved from his parents' home to study in other city. He didn't take any cash with him, he onl ...

  8. URAL 2014 Zhenya moves from parents --线段树

    题意:儿子身无分文出去玩,只带了一张他爸的信用卡,当他自己现金不足的时候就会用信用卡支付,然后儿子还会挣钱,挣到的钱都是现金,也就是说他如果有现金就会先花现金,但是有了现金他不会还信用卡的钱.他每花一 ...

  9. Gym 100851E Easy Problemset (水题,模拟)

    题意:给定 n 个裁判,然后每个都一些题目,现在要从每一个按顺序去选出 k 个题,并且这 k 个要按不递减顺序,如果没有,就用50补充. 析:就按他说的来,直接模拟就好. 代码如下: #pragma ...

随机推荐

  1. sql 存储过程 循环使用

    USE [clab] GO /****** Object: StoredProcedure [dbo].[sp_bd_getResultByEcd] Script Date: 08/06/2014 1 ...

  2. javascript算法汇总(持续更新中)

    1. 线性查找 <!doctype html> <html lang="en"> <head> <meta charset="U ...

  3. n人比赛,可轮空,比赛轮数和场数

    #include<stdio.h> int chang(int x,int s){ ) return s; ) ; !=){ s+=(x-)/; )/,s); } else{ s+=x/; ...

  4. 转:java提取图片中的像素

    本文转自:http://www.infosys.tuwien.ac.at/teaching/courses/WebEngineering/References/java/docs/api/java/a ...

  5. 如何使用 Java 测试 IBM Systems Director 的 REST API

    转自: http://www.ibm.com/developerworks/cn/aix/library/au-aix-systemsdirector/section2.html 如何使用 Java ...

  6. 获取本机外网ip和内网ip

    获取本机外网ip //获取本机的公网IP public static string GetIP() { string tempip = ""; try { WebRequest r ...

  7. Java与正则表达式

    Java与正则表达式 标签: Java基础 正则 正如正则的名字所显示的是描述了一个规则, 通过这个规则去匹配字符串. 学习正则就是学习正则表达式的语法规则 正则语法 普通字符 字母, 数字, 汉字, ...

  8. CodeForces Round #278 (Div.2) (待续)

    A 这么简单的题直接贴代码好了. #include <cstdio> #include <cmath> using namespace std; bool islucky(in ...

  9. UVa 1153 Keep the Customer Satisfied 【贪心 优先队列】

    题意:给出n个工作,已知每个工作需要的时间last,以及截止时间end,(必须在截止时间之前完成)问最多能够完成多少个工作 首先预处理,将这n件任务按照截止时间从小到大排序 然后用一个cur记录当前做 ...

  10. 转载:Unobtrusive JavaScript in ASP.NET MVC 3 隐式的脚本在MVC3

    Unobtrusive JavaScript 是什么? <!--以下是常规Javascript下写出来的Ajax--> <div id="test"> &l ...