** poj Y2K Accounting Bug 2586

** poj Y2K Accounting Bug 2586

大家好,又见面了,我是全栈君,今天给大家准备了Idea注册码。

Y2K Accounting Bug
Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 10117   Accepted: 5043

Description

Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for preparing annual report for MS Inc.

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

Input is a sequence of lines, each containing two positive integers s and d.

Output

For each line of input, output one line containing either a single integer giving the amount of surplus for the entire year, or output Deficit if it is impossible.

Sample Input

59 237
375 743
200000 849694
2500000 8000000

Sample Output

116
28
300612
Deficit

Source

版权声明:本文博主原创文章,博客,未经同意不得转载。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/116872.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 基于SPSS的聚类分析原理概述[通俗易懂]

    基于SPSS的聚类分析原理概述[通俗易懂]在声音样本数目比较多的情况下,直接进行成对比较法,工作量非常大,且评价者容易疲劳,在很大程度上影响评价结果的一致性和准确性。对于这种情况,采用聚类分析,从30个声音样本中选择有代表性的样本进行主观评价试验,大大降低了主观评价试验的工作量

    2022年10月18日
    2
  • JMH 测试「建议收藏」

    JMH 测试「建议收藏」JHM测试框架

    2022年7月11日
    26
  • python编程前景_Python前景如何,学完后可以从事方向?

    python编程前景_Python前景如何,学完后可以从事方向?前段时间浙江八年级新增了Python编程的课程,消息一出,引起了很多人的关注。连中学生都在学Python了,你还在犹豫要不要学习吗?对于想学Python,却又担心Python前景以及学完后可以从事方向的人,下面,小雷就给大家介绍一下。Python前景怎么样?目前国内外很多公司都在使用Python,例如搜索引擎Google的核心代码是Python完成的、迪士尼公司动画生成的Unix版本都内建了Pyt…

    2022年5月16日
    40
  • rpm 安装 忽略依赖_rpm卸载软件忽略循环依赖

    rpm 安装 忽略依赖_rpm卸载软件忽略循环依赖今天由于某些原因需要卸载掉服务器上的php软件,然后我使用下面命令显示出本机安装的所有和php相关的软件,如下:iteblog$rpm-qa|grepphpphp-mysqlnd-5.6.25-0.1.RC1.el6.remi.x86_64php-fpm-5.6.25-0.1.RC1.el6.remi.x86_64php-pecl-jsonc-1.3.10-1.el6.remi.5.6…

    2022年9月22日
    3
  • java绘图板

    java绘图板

    2021年12月7日
    34
  • 【MySQL】使用Visio绘制数据库关系模型图

    【MySQL】使用Visio绘制数据库关系模型图使用Visio绘制数据库关系模型图1新建项目文件—新建–软件和数据库—数据库模型图点击后,出现如下界面:2绘制左侧“实体关系”中将“实体”形状拖放到绘制界面,如下图3编辑实体名称,如下图:4编辑列点击“列”如下图:完成实体:客人信息表GuestRecord,如下截图完成实体:客房表Room(同上操作),如下图5关系绑定5.1添加列RoomID到客人信息表5.2将“实体关系”中的关系工具拖放到某个实体上(鼠标不松开),直到该实体边框变红色,松开;箭头指

    2022年7月16日
    14

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号