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

最新文章

  1. Toast显示图文界面——Android开发之路1
  2. AngularJs之五
  3. CSS3——transform学习
  4. Eclipse linux tools 插件
  5. 转 Delphi Invalidate的用法
  6. CSS抗锯齿 font-smoothing 属性介绍
  7. 对于a标签点击之后可以发邮件和打电话的功能实现
  8. 腾讯云CentOS7安装LNMP+wordpress
  9. 【php学习】图片操作
  10. 【BZOJ】【1037】【ZJOI2008】生日聚会party
  11. 【暑假】[实用数据结构]前缀树 Trie
  12. Packetbeat协议扩展开发教程 一
  13. ORACLE归档模式和非归档模式的利与弊
  14. 数矩形(N - 暴力求解、打表)
  15. web开发中前后端传值
  16. python3学习笔记之十七
  17. 【记录】Xmind8 Pro 激活
  18. Unity录音
  19. BInsertSort
  20. 自签名证书 nginx tomcat

热门文章

  1. mysql 行列动态转换(列联表,交叉表)
  2. Java开发之单例设计模式
  3. poj 2891 Strange Way to Express Integers (扩展gcd)
  4. Android系统服务-WindowManager
  5. UVa 12563 (01背包) Jin Ge Jin Qu hao
  6. JavaScript学习笔记(备忘录)
  7. NYOJ-779-兰州烧饼
  8. 【周期串】NYOJ-1121 周期串
  9. 通过js检测到iframe,使父窗口重定向到index -----------???----------------------
  10. C# 无边框异型窗体制作