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


相关推荐

  • 数组转化为list

    数组转化为list1、Arrays.asList(strArray)方式将数组转换List后,不能对List增删,只能查改,否则抛异常。此时是java.util.Arrays.ArrayList这里面有java.util.Arrays里面的内部类,里面没有重写增删方法,就会调用父类的AbstractList,可以看到父类的增删方法,就会报错,即使调用iterator也会报错。publicvoi…

    2022年6月29日
  • 有监督学习与无监督学习的几大区别

    有监督学习与无监督学习的几大区别当下无监督作为一种热门的机器学习技术,网上有不少关于无监督与有监督差异讨论的文章。DataVisor作为率先将无监督技术运用在反欺诈行业的娇娇领先者,我们在本文中,将深入浅出的讲解无监督机器学习技术与有监督技术在不同方面的区别,通过对比这两种技术,让大家对无监督反欺诈技术有更好的了解。对比一:有标签vs无标签有监督机器学习又被称为“有老师的学习”,所谓的老师就是标签。有监督的过程为先通…

    2022年5月8日
  • C/C++——打开文件读取数据的各种方式「建议收藏」

    C/C++——打开文件读取数据的各种方式「建议收藏」打开文件在fstream类中,成员函数open()实现打开文件的操作,从而将数据流和文件进行关联,通过ofstream,ifstream,fstream对象进行对文件的读写操作函数:open()voidopen(constchar*filename,ios_base::openmodemode=ios_base::in|ios_base::ou

    2022年10月14日
  • 如何通过JNI传递对象执行回调

    如何通过JNI传递对象执行回调

    2021年5月6日
  • js数组排序—自定义快速排序

    js数组排序—自定义快速排序数组自带的sort方法 vararr=[3,4,2,1]; arr.sort(); console.log(arr);进行递增排序(4)[1,2,3,4]sort方法可以接收一个参数,用来自定义排序规则 arr.sort(function(val1,val2){ //returnval1-val2;默认 returnval2-…

    2022年5月5日
  • 如何用matlab画圆

    如何用matlab画圆用matlab画一个以(40,40)为圆心,以20位半径的圆r=20;%设置半径为20theta=0:pi/100:2*pi;%以pi/100为圆心角画圆x=40+r*cos(theta);…

    2022年6月19日

发表回复

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

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