** poj Y2K Accounting Bug 2586
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 10117 | Accepted: 5043 |
Description
All what they remember is that MS Inc. posted a surplus or a deficit each month of 1999 and each month when MS Inc. posted surplus, the amount of surplus was s and each month when MS Inc. posted deficit, the deficit was d. They do not remember which or how
many months posted surplus or deficit. MS Inc., unlike other companies, posts their earnings for each consecutive 5 months during a year. ACM knows that each of these 8 postings reported a deficit but they do not know how much. The chief accountant is almost
sure that MS Inc. was about to post surplus for the entire year of 1999. Almost but not quite.
Write a program, which decides whether MS Inc. suffered a deficit during 1999, or if a surplus for 1999 was possible, what is the maximum amount of surplus that they can post.
Input
Output
Sample Input
59 237
375 743
200000 849694
2500000 8000000
Sample Output
116
28
300612
Deficit
Source
field=source&key=Waterloo+local+2000.01.29">Waterloo local 2000.01.29
这个我确实没怎么弄懂,题意可能没理解
#include<iostream>
using namespace std;
int main()
{
int s,d;
while(scanf("%d %d",&s,&d)!=EOF)
{
int i,ans;
for(i=1;i<=5;i++)
if(s*(5-i)-d*i<0)
break;
if(i==4)
ans=3*s-9*d;
else
ans=s*(12-2*i)-d*2*i;
if(i==5||ans<0)
cout<<"Deficit"<<endl;
else
printf("%d\n",ans);
}
//return 0;
}
版权声明:本文博主原创文章,博客,未经同意不得转载。
** poj Y2K Accounting Bug 2586的更多相关文章
- Y2K Accounting Bug - 2586
Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11271 Accepted: 5672 Description Ac ...
- 贪心 POJ 2586 Y2K Accounting Bug
题目地址:http://poj.org/problem?id=2586 /* 题意:某公司要统计全年盈利状况,对于每一个月来说,如果盈利则盈利S,如果亏空则亏空D. 公司每五个月进行一次统计,全年共统 ...
- Poj 2586 / OpenJudge 2586 Y2K Accounting Bug
1.Link: http://poj.org/problem?id=2586 2.Content: Y2K Accounting Bug Time Limit: 1000MS Memory Lim ...
- 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: 8678 Accepted: 428 ...
- POJ 2586:Y2K Accounting Bug(贪心)
Y2K Accounting Bug Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10024 Accepted: 4990 D ...
- POJ 2586 Y2K Accounting Bug(枚举洪水问题)
Y2K Accounting Bug Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10674 Accepted: 53 ...
- 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 ...
随机推荐
- HttpGet协议与正则表达
使用HttpGet协议与正则表达实现桌面版的糗事百科 写在前面 最近在重温asp.net,找了一本相关的书籍.本书在第一章就讲了,在不使用浏览器的情况下生成一个web请求,获取服务器返回的内容.于 ...
- Unity学习笔记(二)——第一个Unity项目Hello Unity
保留版权,转载请注明出处:http://blog.csdn.net/panjunbiao/article/details/9318811 在这一篇文章里,参照宣雨松的<Unity 3D游戏开发& ...
- java泛型 之 入门(interface)
一:泛型简单介绍: (1)所谓泛型,就是变量类型的參数化. 泛型是JDK1.5中一个最重要的特征.通过引入泛型,我们将获得编译时类型的安全和执行时更小的抛出ClassCastException的可能. ...
- 一张图总结Google C++编程规范(Google C++ Style Guide)
Google C++ Style Guide是一份不错的C++编码指南,我制作了一张比較全面的说明图,能够在短时间内高速掌握规范的重点内容.只是规范毕竟是人定的,记得活学活用.看图前别忘了阅读以下三条 ...
- linux上svn连接visual svn server时ssl鉴权失败,问题解决(转)
场景:1.在windows 7上安装了visual svn server作为自己的svn服务器. 2.在虚拟机centos 6.3上使用svn客户端check代码,报错: [plain] view p ...
- Netflix公司监控内部安全的开源项目
Netfix公司已经公布了三个内部工具,用于捕捉黑客在使用互联网服务时留下的痕迹. AndyHoernecke和Netflix公司的云安全团队成员ScottBehrens指出:"很多安全团队 ...
- Cocos2d-x发展---更改父的颜色、透明度的子节点上
标题手段:当我们改变父节点或透明时的颜色.默认是不会影响孩子的节点. 作为交换组看到朋友说可以通过设置相关的参数变化的子节点来实现属性的效果,看了看源代码,记录下来: 引擎版本号为:2. ...
- MAC地址格式小结
之前一段时间在做网卡驱动的工作,如今产品量产,利用ifconfig eth hw ether在配置mac地址时发现一个问题, 随机配置一个mac地址,发现有的会报出Cannot assign requ ...
- UML之部署图(Deployment Diagram)
计算机系统由硬件和软件组成,应用软件的命令,先转化为操作系统命令,再转化为汇编语言,最后再转化为二进制命令,由硬件来运行.软件要部署到硬件上才具有生命.Deployment Diagram展示的就是把 ...
- java IO流文件的读写具体实例
IO流的分类:1.根据流的数据对象来分:高端流:所有的内存中的流都是高端流,比如:InputStreamReader 低端流:所有的外界设备中的流都是低端流,比如InputStream,Output ...