** 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 ...
随机推荐
- 关于hibernate中多对多关系
关于多对多关系 数据库:在使用多对多的关系时,我们能够使用复合主键.也能够不使用,直接引入外键相同能够实现. 在数据库中使用多对多关系时,须要一个中间表. 多对多关系中的数据库结构例如以下: 表:Or ...
- 自己动手写处理器之第一阶段(2)——MIPS指令集架构的演变
将陆续上传本人写的新书<自己动手写处理器>(尚未出版),今天是第三篇.我尽量每周四篇 MIPS指令集架构自上世纪80年代出现后.一直在进行着更新换代,从最初的MIPS I到MIPS V,发 ...
- Delphi过程函数传递参数的八种方式
今天一同事问我为什么有些过程函数里面有Var而有些没有,不解,遂到网上百度,得解.快哉,快哉. 在Delphi过程.函数中传递参数几个修饰符为Const.Var.Out.另一种不加修饰符的为默认按值传 ...
- GitLab 5.3 升级注意事项
最主要就是需要更新的Git.我的Ubuntu12.04通过apt-get install安装的git版本过低. 所以只能通过源代码安装. 参考下面的步骤: wget git-core.googleco ...
- HelloGithub
<HelloGithub月刊>第一期 <HelloGithub月刊> 因为现在这个项目只有我自己做,只敢叫“月刊”,希望有志同道合者,快点加入到这个项目中来!同时,如果您有 ...
- Java时间比較
Date类有两个方法 一个是after()比方date1.after(date2)推断date1是否在date2之后也就是说date1小于date2吧, 一个是before()比方date1.befo ...
- Dan计划:重新定义人生的10000个小时 - 阮一峰的网络日志
Dan计划:重新定义人生的10000个小时 - 阮一峰的网络日志 Dan计划:重新定义人生的10000个小时
- poj2253(最短路小变形)
题目连接:http://poj.org/problem?id=2253 题意:给出一个无向图,求一条1~2的路径使得路径上的最大边权最小. 分析:dij将距离更新改成取最大值即可,即dp[i]表示到达 ...
- RoboGuice注入框架简单应用
1.设置Activity为RoboActivity; 2.设置界面@ContentView(int resId) 3.使用@InjectView(int resId)反射组件 4.使用@Inject ...
- Win32 Windows编程 十
一 Windows画图 1 图形绘制 1.1 图形绘制的方式 获取到画图的句柄,设备描写叙述符(DC).使用对应的画图API.在设备上绘制图形 1.2 颜色 RGB,每种颜色8位,共24位颜色 32位 ...