poj 2586 Y2K Accounting Bug(贪心算法,水题一枚)
#include <iostream>
using namespace std;
/*248K 32MS*/
int main()
{
int s,d;
while(cin>>s>>d)
{
int count=0;
for(int i=5;i>0;i--)
{
if(s*i<(5-i)*d)
{
count=i;
break;
}
} int total=s*count-d*(5-count);
total*=2; if(count>=2)
total+=2*s;
else
total+=count*s-(2-count)*d; if(total<0)
cout<<"Deficit"<<endl;
else
cout<<total<<endl;
}
}
水题 就不多说什么了,直接枚举就能ac
poj 2586 Y2K Accounting Bug(贪心算法,水题一枚)的更多相关文章
- poj 2586 Y2K Accounting Bug (贪心)
		Y2K Accounting Bug Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8678 Accepted: 428 ... 
- POJ 2586 Y2K Accounting Bug 贪心 难度:2
		Y2K Accounting Bug Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10537 Accepted: 52 ... 
- POJ 2586 Y2K Accounting Bug(枚举大水题)
		Y2K Accounting Bug Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10674 Accepted: 53 ... 
- 贪心 POJ 2586 Y2K Accounting Bug
		题目地址:http://poj.org/problem?id=2586 /* 题意:某公司要统计全年盈利状况,对于每一个月来说,如果盈利则盈利S,如果亏空则亏空D. 公司每五个月进行一次统计,全年共统 ... 
- poj  2586         Y2K Accounting Bug
		http://poj.org/problem?id=2586 大意是一个公司在12个月中,或固定盈余s,或固定亏损d. 但记不得哪些月盈余,哪些月亏损,只能记得连续5个月的代数和总是亏损(<0为 ... 
- POJ 2586 Y2K Accounting Bug(枚举洪水问题)
		Y2K Accounting Bug Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10674 Accepted: 53 ... 
- [POJ 2586] Y2K Accounting Bug (贪心)
		题目链接:http://poj.org/problem?id=2586 题目大意:(真难读懂啊)给你两个数,s,d,意思是MS公司每个月可能赚钱,也可能赔钱,如果赚钱的话,就是赚s元,如果赔钱的话,就 ... 
- POJ 2586 Y2K Accounting Bug(贪心)
		题目连接:http://poj.org/problem?id=2586 题意:次(1-5.2-6.3-7.4-8.5-9.6-10.7-11.8-12),次统计的结果全部是亏空(盈利-亏空<0) ... 
- POJ - 2586 Y2K Accounting Bug (找规律)
		Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for ... 
随机推荐
- Spring 从零開始-05
			最终能到Spring的AOP编程了,AOP的概念特别的多.所以须要你在開始之前有点了解,然后通过代码慢慢学习! - 切面(Aspect):一个关注点的模块化,这个关注点实现可能另外横切多个对象.事务管 ... 
- 支付宝打造公共账号业务网关, RSA密钥对生成
			作者: 玉龙 版权全部,同意转载. 请注明出处(创建金融_玉龙 http://www.weibo.com/u/1872245125) 原文地址: http://blog.csdn.net/ ... 
- asp.net2.0安全性(1)--用户角色篇(代码实现2)--转载来自车老师
			加载所有用户 MembershipUserCollection user = Membership.GetAllUsers(); listUser.DataSource = user; listUse ... 
- 类似QtiPlot的veusz,sigmaplot,pymol
			qtiplot在win下没那么好编译 依赖很多外部包的 scidavis 和 labplot是从他fork出来的 比较接近Origin 可以用这两个 FreeBSD 的 ports 里有直接 cd / ... 
- wift - 使用UIScreen类获取屏幕大小尺寸
			UISreen类代表了屏幕,开发中一般用来获取屏幕相关的属性,例如获取屏幕的大小. 1 2 3 4 5 6 7 //获取屏幕大小 var screenBounds:CGRect = UIScreen. ... 
- spring mvc controller json数据
			项目中遇到个批处理,需要前台传递一个json格式对象数组,如下:var data={ "wos":[{"id":1,"satisfaction&q ... 
- 部署Spring Boot应用
			在开发Spring Boot应用的过程中,Spring Boot直接执行public static void main()函数并启动一个内嵌的应用服务器(取决于类路径上的以来是Tomcat还是jett ... 
- zabbix 监控jmx 需要--enable-java
			安装Javagateway如果原来已经安装zabbix,只需要再添加以下zabbix-java # tar zxvf zabbix-2.2.0.tar.gz # cd zabbix-2.2.0 # . ... 
- 医院API免费接口的公布
			医院通网(http://hospital.yi18.net) 站点上站快两个月了,基本已经稳定,尽管还有非常多小bug,但还是不影响大局.抱着数据开放和共享的理念,医院大全API接口 (http:// ... 
- session对象和applicatione对象
			ASP.NET 的常用对象有:response对象.request对象.application对象.server对象.session对象.下面主要讨论session对象和cookie对象. sessi ... 
