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


相关推荐

  • MAX31865模块的使用-基于ZigBee_CC2530芯片 PT100测温

    MAX31865模块的使用-基于ZigBee_CC2530芯片 PT100测温前言  网络上关于ZigBee和MAX31865的相关资料较少,对于如何在CC2530上实现对PT100温度数据的读取的资料更是几乎没有。因此本文对MAX31865芯片和模块的使用进行简要介绍,并提供使用源码,同时提供自制模块的相关原理图。文章目录前言一、相关资料二、MAX31865芯片介绍2.1简介:2.2:读写时序2.3:配置寄存器2.4错误标志2.5温度读取三、MAX31865模块介绍3.1引脚介绍3.2线制选择与接线四、代码4.1配置I/O寄存器4.2SPI写寄存器4.3SPI读寄存

    2022年6月29日
    26
  • 解决eclipse乱码问题[通俗易懂]

    解决eclipse乱码问题[通俗易懂]本文章主要解决eclipse工程区乱码问题。

    2022年5月26日
    39
  • bios设置pcie通道_PCI LAN

    bios设置pcie通道_PCI LANPCIewithlspciPCIeWidth#lspci-s81:00.0-vvv|grepWidthLnkCap:Port#0,Speed8GT/s,Widthx16,ASPMnotsupported,ExitLatencyL0sunlimited,L1unlimited…

    2025年10月14日
    6
  • mysql锁表原因及如何处理_表被锁了还能查询

    mysql锁表原因及如何处理_表被锁了还能查询1、锁表发生在insert update、delete中  2、锁表的原理是数据库使用独占式封锁机制,当执行上面的语句时,对表进行锁住,直到发生commite或者回滚或者退出数据库用户 3、锁表的原因  第一、A程序执行了对tableA的insert,并还未commite时,B程序也对tableA进行insert则此时会发生资源正忙的异常就是锁表 第二、锁表常…

    2022年8月23日
    4
  • 微服务优缺点_微服务优势和不足

    微服务优缺点_微服务优势和不足优点1.每个微服务都很小,这样能聚焦一个指定的业务功能或业务需求;2.微服务能够被小团队单独开发;3.微服务是松耦合的,是有功能意义的服务,无论是在开发阶段或部署阶段都是独立的;4.微服务能使用不同的语言开发;5.微服务易于被一个开发人员理解,修改和维护,这样小团队能够更关注自己的工作成果,无需通过合作才能体现价值;6.微服务只是业务逻辑的代码,不会和HTML,CSS或其他界面组件混合;缺点:1.运维要求较高; 2.分布式的复杂性; 3.接口调整成本高; 4.学习难度曲线

    2025年8月23日
    3
  • docker网络配置方法总结

    docker网络配置方法总结

    2022年2月5日
    57

发表回复

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

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