** 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)
上一篇 2022年1月14日 上午11:00
下一篇 2022年1月14日 上午11:00


相关推荐

  • Java的TreeMap和HashMap的介绍和使用

    Java的TreeMap和HashMap的介绍和使用1 TreeMap 的介绍和使用第 1 部分 TreeMap 介绍 TreeMap 简介 TreeMap 是一个有序的 key value 集合 它是通过红黑树实现的 TreeMap nbsp 继承于 AbstractMap 所以它是一个 Map 即一个 key value 集合 TreeMap 实现了 NavigableMap 接口 意味着它支持一系列的导航方法 比如返回有序的 key 集合

    2026年3月17日
    2
  • 电子学报、计算机研究与发展中文期刊投稿过程记录

    电子学报、计算机研究与发展中文期刊投稿过程记录电子学报 计算机研究与发展中文期刊投稿过程记录电子学报 一月二十投稿 至十一月十五录用排版 历时十个多月 总体来说电子学报很规范很严 历经两次外审 审稿意见很犀利 计算机研究与发展 总历时大约六七个月 审稿严格 速度较快 但是出版慢 提前给录用通知 安排到 2021 年 10 月出版

    2025年11月11日
    3
  • 2021美赛B题解题思路(Fighting Wildfires)

    2021美赛B题解题思路(Fighting Wildfires)准时赴约 等待开题中

    2026年3月19日
    2
  • 漫步数理统计二十六——多元正态分布

    漫步数理统计二十六——多元正态分布本片博文介绍多元正态分布,我们以nn维随机变量为主,但给出n=2n=2时二元情况的一些实例。与上篇文章一样,我们首先介绍标准情况然后扩展到一般情况,当然这里会用到向量与矩阵符号。考虑随机向量Z=(Z1,…,Zn)′\mathbf{Z}=(Z_1,\ldots,Z_n)^\prime,其中Z1,…,ZnZ_1,\ldots,Z_n是独立同分布的N(0,1)N(0,1)随机变量,那么对z∈Rn,Z\ma

    2025年7月31日
    5
  • RecyclerView粘性头部控件 – sticky-headers-recyclerview,RecyclerView滚动后,onHeaderClick回调位置不对

    RecyclerView粘性头部控件 – sticky-headers-recyclerview,RecyclerView滚动后,onHeaderClick回调位置不对RecyclerView 粘性头部控件 Github timehop sticky headers recyclerview 使用开源控件 当 RecyclerView 滚动到第一个 Header 不显示的位置时 点击 Header 区域回调的 onHeaderClic 的 position 错误 需要以下代码修正 headListener newStickyRec OnHeaderClic Override

    2026年3月16日
    3
  • 可能是史上最全的权限系统设计

    可能是史上最全的权限系统设计权限系统设计前言权限管理是所有后台系统的都会涉及的一个重要组成部分,主要目的是对不同的人访问资源进行权限的控制,避免因权限控制缺失或操作不当引发的风险问题,如操作错误,隐私数据泄露等问题。目前在

    2022年7月4日
    27

发表回复

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

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