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


相关推荐

  • 应用date函数读取系统当前时间_获取系统时间的代码

    应用date函数读取系统当前时间_获取系统时间的代码在c#/ASP.net中我们可以通过使用DataTime这个类来获取当前的时间。通过调用类中的各种方法我们可以获取不同的时间:如:日期(2008-09-04)、时间(12:12:12)、日期+时间(2008-09-0412:11:10)等。//获取日期+时间 DateTime.Now.ToString();//2008-9-420:02:10 DateTime.Now.ToLo…

    2022年8月31日
    0
  • 有哪些顶级水平的中国程序员?[通俗易懂]

    有哪些顶级水平的中国程序员?[通俗易懂]本文转载自启舰杂谈我们熟知的很多程序员都是国外的。那我们中国有没有顶尖级的程序员,出于好奇,我全网进行了搜罗,这里把我认为比较厉害的一些程序员展示给大家。篇幅有限,很多程序员我也没听过,所以就没有展示。排名顺序也没什么特别的,先看上谁,谁就排第一。比如,第一的尤雨溪单纯就是因为他长的帅如果你认为还有哪位大咖是你心目中的神,可以列出来,如果列的人多的话,我再搞一期给大家介绍介绍。一、尤雨溪江湖流传一个小故事:一款名叫Clear的软件,在…

    2022年10月11日
    0
  • IDEA2021.8.3激活码(注册激活)

    (IDEA2021.8.3激活码)2021最新分享一个能用的的激活码出来,希望能帮到需要激活的朋友。目前这个是能用的,但是用的人多了之后也会失效,会不定时更新的,大家持续关注此网站~IntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,下面是详细链接哦~https://javaforall.net/100143.html…

    2022年3月26日
    49
  • android的surfaceflinger原理学习「建议收藏」

    android的surfaceflinger原理学习「建议收藏」概念SurfaceFlinger是一个系统服务,如:audioflinger,audiopolicyservice等等,系统的主要服务通过这个文章进行了解,Android的系统服务一览。这个系统服务主要实现了Surface的建立、控制、管理等功能。换种说法就是,在Android的实现中它是一个service,提供系统范围内的surfacecomposer功能,它能够将各种应用程序的2D、3…

    2022年4月18日
    53
  • oracle数据库查询语句大全_oracle查询是否存在记录

    oracle数据库查询语句大全_oracle查询是否存在记录1oracle数据库查询表的所有数据–select*from表名;(*代表所有)2oracle数据库查询表中指定字段的值–select字段名1,字段名2,……from表名;3oracle数据库往表中添加数据信息–(添加信息使用insertinto语句)insertinto表名values(添加相对应的数据信息,如果在一个字段名中没有信息可以用“null”nul…

    2022年9月8日
    0
  • java前端开发自动生成器_一个简单实用的java代码生成器

    java前端开发自动生成器_一个简单实用的java代码生成器做现在这破项目boss还觉得进度慢,时间其实都浪费在了基础的CRUD上了,一个上午好不容易调通从action到service在到dao在到数据库的crud。工欲善其事必先利其器,有一款趁手的工具可有效提高开发效率,推荐一个简单实用的在线java代码生成器。代码生成器只是xjr快速开发框架功能的一部分。这款代码生成器是一款国内最新自主研发的JAVA代码自动生成器,目前来看这是一款十分赞的代码…

    2022年5月23日
    40

发表回复

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

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