ural 2015 Zhenya moves from the dormitory(模拟)
2015. Zhenya moves from the dormitory
Memory limit: 64 MB
Input
Output
Samples
input | output |
---|---|
10000 50 70 |
You should rent the apartment #1 alone. |
30000 0 1 |
You should rent the apartment #3 with the friend #1. |
1000 0 0 |
Forget about apartments. Live in the dormitory. |
Notes
Problem Source: NEERC 2014, Eastern subregional contest
All submissions (3048) All accepted submissions (740) Solutions rating (524)
#include <bits/stdc++.h>
using namespace std;
int alonecost,alone1value,alone2value;
int friendcost[],friendvalue[],friendnum; int main ()
{
int n;
while(~scanf("%d%d%d",&alonecost,&alone1value,&alone2value))
{
scanf("%d",&friendnum);
for(int i=; i<=friendnum; i++)
scanf("%d%d",&friendcost[i],&friendvalue[i]);
scanf("%d",&n);
int resnum=-,resval=-,resfrinum,resalOrdou;
int alOrdou,cost,value;
for(int i=; i<=n; i++)
{
scanf("%d%d%d",&alOrdou,&cost,&value);
if(cost<=alonecost)///自己住
{
// cout<<"====\n";
if(alOrdou== && value+alone1value > resval)
{
// cout<<"PPPPPPP\n";
resnum=i,resval=value+alone1value,resalOrdou=,resfrinum=-;
}
else if(alOrdou== && value+alone2value > resval)
{
resnum=i,resval=value+alone2value,resalOrdou=,resfrinum=-;
}
}
if(alOrdou== && alonecost>=(cost+)/)
{
//cout<<"++++++++\n";
for(int j=; j<=friendnum; j++)
{
if(friendcost[j]>=(cost+)/ && friendvalue[j]+value>resval)
{
resnum=i,resval=friendvalue[j]+value,resfrinum=j,resalOrdou=;
}
}
}
}
if(resnum==-)
{
printf("Forget about apartments. Live in the dormitory.\n");
}
else
{
printf("You should rent the apartment #%d ",resnum);
if(resalOrdou==)
{
printf("with the friend #%d.\n",resfrinum);
}else{
printf("alone.\n");
}
}
//cout<<resval<<endl;
}
return ;
}
ural 2015 Zhenya moves from the dormitory(模拟)的更多相关文章
- Gym 100507D Zhenya moves from the dormitory (模拟)
Zhenya moves from the dormitory 题目链接: http://acm.hust.edu.cn/vjudge/contest/126546#problem/D Descrip ...
- ural 2014 Zhenya moves from parents
2014. Zhenya moves from parents Time limit: 1.0 secondMemory limit: 64 MB Zhenya moved from his pare ...
- 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. ...
- URAL 2014 Zhenya moves from parents --线段树
题意:儿子身无分文出去玩,只带了一张他爸的信用卡,当他自己现金不足的时候就会用信用卡支付,然后儿子还会挣钱,挣到的钱都是现金,也就是说他如果有现金就会先花现金,但是有了现金他不会还信用卡的钱.他每花一 ...
- Gym 100507C Zhenya moves from parents (线段树)
Zhenya moves from parents 题目链接: http://acm.hust.edu.cn/vjudge/contest/126546#problem/C Description Z ...
- ural2014 Zhenya moves from parents
Zhenya moves from parents Time limit: 1.0 secondMemory limit: 64 MB Zhenya moved from his parents’ h ...
- c# JD快速搜索工具,2015分析JD搜索报文,模拟请求搜索数据,快速定位宝贝排行位置。
分析JD搜索报文 搜索关键字 女装 第二页,分2次加载. rt=1&stop=1&click=&psort=&page=3http://search.jd.com/Se ...
- 2015 多校联赛 ——HDU5319(模拟)
Painter Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Su ...
- 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 ...
随机推荐
- HNOI2019爆零记
HNOI2019真-爆零祭 我怎么这么菜QAQ day-37 从学科溜过来搞OI. 班主任一直在谈论我退役的事情,这就是NOIP挂分的后果...说我没考好就找理由,人家xxxxxxx可不是xxxxxx ...
- MySQL版本升级5.6到5.7版本
从5.6升级到5.7版本,5.7的版本为5.7.17 升级的过程还是比较简单,需要注意几个点 1.下载对应的包 2.备份整个数据库 3.使用升级参数 1.下载 # wget "https:/ ...
- MySQL中锁问题
1.脏读 脏页只是在缓冲池中已经修改的页但是没有刷新到磁盘中,即数据库实例内存中的页和磁盘中的页事不一致的,当然在刷新到磁盘之前,日志都已经被写入到了重做日志文件中,而所谓的脏数据是指事务对缓冲池中行 ...
- PAT 1073 多选题常见计分法 (20 分)
批改多选题是比较麻烦的事情,有很多不同的计分方法.有一种最常见的计分方法是:如果考生选择了部分正确选项,并且没有选择任何错误选项,则得到 50% 分数:如果考生选择了任何一个错误的选项,则不能得分.本 ...
- Python排列组合
product 笛卡尔积 (有放回抽样排列) permutations 排列 (不放回抽样排列) combinations 组合,没有重复 (不放回抽样组合) combinations_with_re ...
- 找出n的阶乘末尾有几个零
原理:因为10由2*5组成,而构成2的因数比5多 所以最终转换成求5的个数 int getNumber(int n) { int count = 0; while(n) { n = n/5; coun ...
- 20170405-STO库存转储单
1.工厂间转储: (1)MB1B 移动类型 301 工厂到工厂(一步)转账,->简单明了一步转储过账后会产生 GR,MITA增加了,MIZH减少了,MB03, **会产生 GR,如果俩工厂 标准 ...
- java ReentrantLock可重入锁的使用场景
摘要 从使用场景的角度出发来介绍对ReentrantLock的使用,相对来说容易理解一些. 场景1:如果发现该操作已经在执行中则不再执行(有状态执行) a.用在定时任务时,如果任务执行时间可能超过下次 ...
- Django的Model继承abstract,proxy,managed。。。
Django 中的 model 继承和 Python 中的类继承非常相似,只不过你要选择具体的实现方式:让父 model 拥有独立的数据库:还是让父 model 只包含基本的公共信息,而这些信息只能由 ...
- Log level with log4j and Spark
Log Level Usages OFF This is the most specific, which allows no logging at all FATAL This is the mos ...