** 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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 发电机机房设计规范_柴油发电机房设计规范.docx[通俗易懂]

    发电机机房设计规范_柴油发电机房设计规范.docx[通俗易懂]柴油发电机房设计规范柴油发电机房设计规范篇一:柴油发电机组设置原则与机房设计  柴油发电机组设置原则与机房设计1引言  新型建筑人流密集,出于防火、消防安全的需要,对供电可靠性提出了严格的要求。目前我们一般采用柴油发电机组作为应急电源,因为柴油发电机的容量较大,持续供电时间长,可独立运行,不受电网故障的影响,可靠性较高。尤其是某些地区常用市电不是很可靠的情况下,把柴油发电机作为备用电源…

    2022年10月2日
    1
  • VC++键盘钩子demo

    VC++键盘钩子demoHHOOKkeyHook=NULL;//先声明函数,实现在下面LRESULTCALLBACKkeyProc(intnCode,WPARAMwParam,LPARAMlParam);//初始化钩子,关闭键盘事件(除了ALT+CTRL+DELETE)voidinitHook(){ keyHook=SetWindowsHookEx(WH_KEYBOARD_LL,keyProc,GetModuleHandle(NULL),0);}//销毁钩子voidun.

    2022年6月14日
    30
  • 基于Tensorflow + yolo3的安全帽识别系统[通俗易懂]

    基于Tensorflow + yolo3的安全帽识别系统[通俗易懂]最近做了一个新的项目,需要将图片或者视频中的人员是否戴安全帽识别出来,并且在网站上进行显示.首先是正常的登录注册目前登录注册有很多方式,这个比较常规,用户名密码登录,也没有写的很复杂.接下来就是主要功能页面了如上图所示,可以进行图片及视频识别图片上传,正在进行识别…

    2022年5月12日
    52
  • 程序员法则xiazai_程序员手册

    程序员法则xiazai_程序员手册第六章论剑  我深深的吸了一口气,让自己的激动的心情平息下来。“大家好,很高兴可以和大家合作开发这个项目,我也不浪费大家的时间,下面我就给大家讲一下这个项目的具体构架情况”。一个个的方案才我的嘴里轻松的说出来,每个人都分配到合适的任务,每个人都清楚的明白自己的目的,我全身心的投入指挥当中,我记得BRUCE,也是我程序道路上的领路人之一,曾经在发给我的EMAIL中说过:“许,你编写的程序让我感受到

    2022年10月7日
    4
  • 生成mysql亿级压测数据程序

    生成mysql亿级压测数据程序

    2021年5月15日
    119
  • Spring Security OAUTH2 获取用户信息

    Spring Security OAUTH2 获取用户信息1.user-info-uri与token-info-uri作用:二者皆是为了checktoken,并且顺带返回了用户信息。配置信息位置在资源服务器上。解释:下面代码列举的都是token-info-uri,user-info-uri不解释。user-info-uri原理是在授权服务器认证后将认证信息Principal通过形参绑定的方法通过URL的方式获取用户信息。当然它也有配套的Us…

    2022年9月8日
    2

发表回复

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

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