** 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

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

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

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

  • createprocess error=2_CreateProcess

    createprocess error=2_CreateProcessOpenProcess函数声明如下,失败则返回NULL(0,也就是false)#include<Windows.h>HANDLEOpenProcess(DWORDdesiredAccess,//读取权限BOOLblnheritHandle,//是否继承DWORDprocessId//想要读取的PID)代码示例,注意下面的代码可能运行失败,请按照如下设置VS右键项目名(例如ConsoleApplication123)->属性->配置属性(注意左上角是活动D

  • 一些常用的yum安装卸载的命令

    一些常用的yum安装卸载的命令

  • windows错误恢复如何解决_0xc0000006是什么错误

    windows错误恢复如何解决_0xc0000006是什么错误0xc0000005三种不同的情况下会发生错误常见原因修复访问错误解决方案1:停用程序的数据执行保护(DEP)解决方案2:在Windows注册表中停用AppInit_DLLs机制解决方案3:执行恶意软件扫描解决方案4:运行Windows内存诊断程序并替换任何有缺陷的RAM启动应用程序时如何解决0xc0000005错误解决方案1:更新设备驱动程序解决方案2:修复BCD文件安装Windows时出现0xc0000005错误:最佳解决方案解决方案1:删除并重新创建Windows硬盘分区解决方案2:更换有缺陷的硬件

  • 安装 | MATLAB2020a (64位) 安装教程及安装包下载链接[通俗易懂]

    安装 | MATLAB2020a (64位) 安装教程及安装包下载链接[通俗易懂]博主github:https://github.com/MichaelBeechan博主CSDN:https://blog.csdn.net/u011344545Matlab2020a链接:链接:https://pan.baidu.com/s/1SfoNj2FC4XMfIbJluRuhUA提取码:解压密码:rjzkgzh<!!!!!!!!打赏后私信我,获取提取码!!!!!!!!!!!!!>打赏链接:https://blog.csdn.net/u011344545/artic

  • lxml中etree.HTML()和etree.tostring()用法[通俗易懂]

    lxml中etree.HTML()和etree.tostring()用法[通俗易懂]fromlxmlimportetreetext=”’&amp;amp;amp;lt;div&amp;amp;amp;gt;&amp;amp;amp;lt;ul&amp;amp;amp;gt;&amp;amp;amp;lt;liclass=&amp;amp;quot;item-0&amp;amp;quot;&amp;amp;amp;gt;&amp;amp;amp;lt;ahref=&amp

    2022年10月22日
  • linux修改密码过期时间echo_linux查看密码修改时间

    linux修改密码过期时间echo_linux查看密码修改时间linux新建用户默认90天密码过期,设置永不过期方法。1、查看某个用户的密码过期时间等信息,可以用:chage-l用户名2、修改单个用户的密码过期时间,可以用chage-Mdaysusername来设置。如:chage-M99999lizi就是把lizi这个用户的最大期限设置为无限,lizi这个用户的密码就永远不会过期了。转载:linux环境下设置用户密码过期期限_amazingsmile的专栏-CSDN博客_linux设置密码不过期…

发表回复

您的电子邮箱地址不会被公开。

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