** 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 ...
随机推荐
- android设置中的Preferencescreen使用方法介绍与分析
今天主要研究了一下设置中的Preferencescreen应用,它不仅可以作为设置界面显示,并且还可以启动activity,以下主要是对启动activity的介绍 1. Preferencescree ...
- 基于S5pv210流媒体server的实现之网络摄像头(by liukun321 咕唧咕唧)
这里仅介绍流媒体server端的实现思路.及编码注意问题,不会贴代码的详细实现. 直接入正题先介绍一下系统硬件框架: server端连接PC机用VLC播放例如以下图: server端应用程序能够分为图 ...
- poj-3791-An Easy Game-记忆化搜索
dp[i][j]:还有i个不同样的位置,还能走j步,一共同拥有多少种走法. 非常明显 dp[i][j]=sigm(dp[i-k][j-1]*c[i][k]*c[n-i][m-k]); 用记忆化搜索记忆 ...
- linux在下面APK反编译软件和过程的描述
需要的工具: 1.apktool apk打包工具 下载地址:http://android-apktool.googlecode.com/files/apktool1.5.2.tar.bz2 安装:直接 ...
- loj1336(数学)
传送门:Sigma Function 题意:定义f(n)为n的约数之和,求[1,n]中f值为偶数的数的个数. 分析:由题目给定公式可知,若f(n)为奇数,则相乘的每一项都必须为奇数. 每一项为奇数的条 ...
- Spring集成XFire开发WebService
Spring是眼下最流行的JavaEE Framework,可是使用Spring的Spring-WS开发WebService却十分繁琐.XFire是一个简化WebService开发的开源项目.通过Sp ...
- 使用WiX Toolset创建.NET程序发布Bootstrapper(安装策略管理)(一)——初识WiX
原文:使用WiX Toolset创建.NET程序发布Bootstrapper(安装策略管理)(一)--初识WiX Visual Studio 打包安装七宗罪 开发.NET的人,肯定会使用Visual ...
- poj2411(状压dp)
题目链接:http://poj.org/problem?id=2411 题意:由1*2 的矩形通过组合拼成大矩形,求拼成指定的大矩形有几种拼法. 分析:如果是横着的就定义11,如果竖着的定义为竖着的0 ...
- ZOJ 1584:Sunny Cup 2003 - Preliminary Round(最小生成树&&prim)
Sunny Cup 2003 - Preliminary Round April 20th, 12:00 - 17:00 Problem E: QS Network In the planet w-5 ...
- java 线程 ProducerAndConsumer
package j2se.thread.demo; /** * <p>Project:J2SE 的基础知识</p> * <p>Tile:多线程模拟 生产者 和 消费 ...