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. 23.allegro中自动布线[原创]

    1. --- 方法①:选择网络自动布线 -- --- 已经步好: --- 方法②: ---- ---- 布线: --- 方法③: -- ----

  2. linq to Entity 数据库除了有主键还有唯一索引,是不是不能更新

    数据库建了一个唯一索引,使用linq to ef更新的时候,老是报,索引建冲突,,坑了我一上午,最后把索引删了

  3. oracle .bash_profile

    [oracle@redhat4 ~]$ vi .bash_profile # .bash_profile # Get the aliases and functionsif [ -f ~/.bashr ...

  4. .NET 内存管理—CLR的工作

    看了http://www.cnblogs.com/liulun/p/3145351.html  不错,补习下相关技术.. 正文: .NET依托CLR进行的内存的管理 有了CLR 基本不需要担心.net ...

  5. ASP.NET中POST提交数据并跳转页面

    需求:先Post提交数据,然后跳转到目标页面 找了好久才发现这个神奇的类HttpHelper.原理很简单,利用html的from表单拼接,然后执行 使用方法: NameValueCollection ...

  6. HDU 1863 畅通工程(最小生成树,prim)

    题意: 给出图的边和点数,要求最小生成树的代价,注:有些点之间是不可达的,也就是可能有多个连通图.比如4个点,2条边:1-2,3-4. 思路: 如果不能连通所有的点,就输出‘?’.之前以为每个点只要有 ...

  7. 【流媒體】live555—VS2010 下live555编译、使用及测试

    Ⅰ live555简介 Live555 是一个为流媒体提供解决方案的跨平台的C++开源项目,它实现了对标准流媒体传输协议如RTP/RTCP.RTSP.SIP等的支持.Live555实现了对多种音视频编 ...

  8. 字符串截取数字和点击radio显示不同内容

    <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> & ...

  9. Android 长按setOnItemLongClickListener 注意细节

    Java代码 gridview.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean ...

  10. ECshop 二次开发模板教程1

    本教程适用于了解 ECshop 和 ECshop模板DIY 以及它们的日常使用,在查看前阁下需要至少会使用一种编辑器(exp:Dreamweaver, editplus, emacs, vi, ee  ...