Y2K Accounting Bug
题目:
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
#include<iostream>
using namespace std;
int main()
{
double s,d;
while(cin>>s>>d)
{
double n;
if(s>= && s<d/) n=*s-*d;
if(s>=d/ && s<*d/) n=*s-*d;
if(s>=*d/ && s<*d/) n=*s-*d;
if(s>=*d/ && s<*d) n=*s-*d;
if(s< || (s== && d>=) || s>=*d) n=-;
if(n>=) cout<<n<<endl;
else cout<<"Deficit\n";
}
return ;
}
Y2K Accounting Bug的更多相关文章
- [POJ2586]Y2K Accounting Bug
[POJ2586]Y2K Accounting Bug 试题描述 Accounting for Computer Machinists (ACM) has sufferred from the Y2K ...
- Y2K Accounting Bug(贪心)
Y2K Accounting Bug Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10945 Accepted: 54 ...
- 贪心 POJ 2586 Y2K Accounting Bug
题目地址:http://poj.org/problem?id=2586 /* 题意:某公司要统计全年盈利状况,对于每一个月来说,如果盈利则盈利S,如果亏空则亏空D. 公司每五个月进行一次统计,全年共统 ...
- Y2K Accounting Bug 分类: POJ 2015-06-16 16:55 14人阅读 评论(0) 收藏
Y2K Accounting Bug Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11222 Accepted: 56 ...
- 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 ...
- POJ2586——Y2K Accounting Bug
Y2K Accounting Bug Description Accounting for Computer Machinists (ACM) has sufferred from the Y2K ...
- poj 2586 Y2K Accounting Bug
http://poj.org/problem?id=2586 大意是一个公司在12个月中,或固定盈余s,或固定亏损d. 但记不得哪些月盈余,哪些月亏损,只能记得连续5个月的代数和总是亏损(<0为 ...
- poj2586 Y2K Accounting Bug(贪心)
转载请注明出处:http://blog.csdn.net/u012860063?viewmode=contents 题目链接:http://poj.org/problem?id=2586 ------ ...
- 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 ...
随机推荐
- 使用localstorage及js模版引擎 开发 m站设想
目前 m站开发的方式,依然请求完整的html,这样造成的问题就是每次请求的数据量过大过多,在没有wifi的情况下,导致页面打开的速度很慢,耗费的流量也较多:访问m站的多是移动端设备,其浏览器的版本都较 ...
- 4MLinux7.0 服务器配置详解 别名TheSSS
TheSSS download 特性:thttp,php5.5.1,mysql,vsftp,proxy,firewall,带rpm管理器.更新频繁. 官方帮助文件:View (新窗口打开) 发现国内4 ...
- HTML 表单和表格
1.使用表单标签 网站使用 HTML 表单可与用户进行交互,表单元素是允许用户在表单中输入内容,比如:文本框.文本域.单选框.复选框.下拉列表.按钮等等,表单可以把浏览者输入的数据传送到服务器端,这样 ...
- javascript 写策略模式,商场收银打折优惠策略
[Decode error - output not utf-8] ----------------------------- 购物清单 方便面 : 100 x 50 = 5000 | 4000 菊花 ...
- [转]Vim 复制粘贴探秘
Vim作为最好用的文本编辑器之一,使用vim来编文档,写代码实在是很惬意的事情.每当学会了vim的一个新功能,就会很大地提高工作效率.有人使用vim几十年,还没有完全掌握vim的功能,这也说明了vim ...
- java中抽象类与接口的区别
1.abstract class 在 Java 语言中表示的是一种继承关系,一个类只能使用一次继承关系.但是,一个类却可以实现多个interface. 2.在abstract class 中可以有自己 ...
- 详解 CSS 属性 - 伪类和伪元素的区别[转]
首先,阅读 w3c 对两者的定义: CSS 伪类用于向某些选择器添加特殊的效果. CSS 伪元素用于将特殊的效果添加到某些选择器. 可以明确两点,第一两者都与选择器相关,第二就是添加一些“特殊”的效果 ...
- 配置mybatis流程
使用mybatis的优点: 1. 易于上手和掌握. 2. sql写在xml里,便于统一管理和优化. 3. 解除sql与程序代码的耦合. 4. 提供映射标签,支持对象与数据库的orm字段关系映射 5. ...
- Windows命令行语法说明
摘自:http://lavasoft.blog.51cto.com/62575/1113234 Windows命令行语法说明 说来惭愧,用windows这么多年了,对其命令行语法看得似懂非懂, ...
- 4069: [Apio2015]巴厘岛的雕塑
Description 印尼巴厘岛的公路上有许多的雕塑,我们来关注它的一条主干道. 在这条主干道上一共有 N 座雕塑,为方便起见,我们把这些雕塑从 1 到 N 连续地进行标号,其中第 i 座雕塑的年龄 ...