#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(贪心算法,水题一枚)的更多相关文章

  1. poj 2586 Y2K Accounting Bug (贪心)

    Y2K Accounting Bug Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8678   Accepted: 428 ...

  2. POJ 2586 Y2K Accounting Bug 贪心 难度:2

    Y2K Accounting Bug Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10537   Accepted: 52 ...

  3. POJ 2586 Y2K Accounting Bug(枚举大水题)

    Y2K Accounting Bug Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10674   Accepted: 53 ...

  4. 贪心 POJ 2586 Y2K Accounting Bug

    题目地址:http://poj.org/problem?id=2586 /* 题意:某公司要统计全年盈利状况,对于每一个月来说,如果盈利则盈利S,如果亏空则亏空D. 公司每五个月进行一次统计,全年共统 ...

  5. poj 2586 Y2K Accounting Bug

    http://poj.org/problem?id=2586 大意是一个公司在12个月中,或固定盈余s,或固定亏损d. 但记不得哪些月盈余,哪些月亏损,只能记得连续5个月的代数和总是亏损(<0为 ...

  6. POJ 2586 Y2K Accounting Bug(枚举洪水问题)

    Y2K Accounting Bug Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10674   Accepted: 53 ...

  7. [POJ 2586] Y2K Accounting Bug (贪心)

    题目链接:http://poj.org/problem?id=2586 题目大意:(真难读懂啊)给你两个数,s,d,意思是MS公司每个月可能赚钱,也可能赔钱,如果赚钱的话,就是赚s元,如果赔钱的话,就 ...

  8. 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) ...

  9. POJ - 2586 Y2K Accounting Bug (找规律)

    Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for ...

随机推荐

  1. Spring 从零開始-05

    最终能到Spring的AOP编程了,AOP的概念特别的多.所以须要你在開始之前有点了解,然后通过代码慢慢学习! - 切面(Aspect):一个关注点的模块化,这个关注点实现可能另外横切多个对象.事务管 ...

  2. poj-3895-Cycles of Lanes 简单DFS

    题目链接: http://poj.org/problem?id=3895 题目意思: 在无向连通图中图中找一个经过边数最多的环. 解题思路: 从任意一点直接DFS,不用回溯,注意构成环的话至少有3条边 ...

  3. java 基于JDK中的源码总结下String二

    申明:转载请注明出处,如有商用目的请务必知会本人,感谢. 上一篇文章:http://blog.csdn.net/ts1122/article/details/8738336,介绍了String一些易错 ...

  4. 为什么必须是final的呢?

    一个谜团 如果你用过类似guava这种“伪函数式编程”风格的library的话,那下面这种风格的代码对你来说应该不陌生: 1 2 3 4 5 6 7 8 9 public void tryUsingG ...

  5. Eclipse Maven 插件地址

    http://download.eclipse.org/technology/m2e/releases maven 插件安装地址

  6. spring mvc3中的addFlashAttribute方法

    spring mvc3中的addFlashAttribute方法  

  7. Mongdb 访问

    http://114.55.75.xx/pics/201607040751367d21a38035bd4da7abd4473783f85f7a

  8. 一些关于linux 下的jni下问题

    编译的细节我就不写了,主要写一些linux下的注意事项,mask一下错误(太多windows的例子了) 编译教程:http://www.cnblogs.com/youxilua/archive/201 ...

  9. Swift - 歌曲播放样例(附带播放时间和播放进度)

    使用MPMoviePlayerController我们可以是进行音乐播放,下面是一个播放器样例.同时,播放时还可以显示播放时间和播放进度. 1 2 3 4 5 6 7 8 9 10 11 12 13 ...

  10. 与众不同 windows phone (5) - Chooser(选择器)

    原文:与众不同 windows phone (5) - Chooser(选择器) [索引页][源码下载] 与众不同 windows phone (5) - Chooser(选择器) 作者:webabc ...