The question ： A company needs to make statistics on its annual profit , For every month , If it's profitable, it's profitable S, If you lose money, you lose money D. The company makes statistics every five months , Statistics of the whole year 8 Time (1-5、2-6、3-7、4-8、5-9、6-10、7-11、8-12), Known 8 The results of these statistics are all in deficit ( profit - Deficit <0). The title gives S and D, Judge whether the whole year is profitable , If you can, find the maximum profit , If you can't make a profit, you can export Deficit

analysis ：

``` The profit and loss of the whole year can be directly determined by the first five months 1、 if SSSSD Deficit , Then the best situation of the whole year is SSSSDSSSSDSS
2、 if SSSDD Deficit , Then the best situation of the whole year is SSSDDSSSDDSS
3、 if SSDDD Deficit , Then the best situation of the whole year is SSDDDSSDDDSS
4、 if SDDDD Deficit , Then the best situation of the whole year is SDDDDSDDDDSD
5、 if DDDDD Deficit , The whole year will be in deficit ...```
``` #include<stdio.h>
int main()
{
int s,d,sum;
while(~scanf("%d%d",&s,&d))
{
sum=;
if(d>*s) sum=*s-*d;
else if(*d>*s) sum=*s-*d;
else if(*d>*s) sum=*s-*d;
else if(*d>s) sum=*s-*d;
else sum=-;
if(sum<=) printf("Deficit\n");
else
printf("%d\n",sum);
}
}```
` `

## POJ 2586 Y2K Accounting Bug（ greedy ） More articles about

1. poj 2586 Y2K Accounting Bug ( greedy )

Y2K Accounting Bug Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8678   Accepted: 428 ...

2. POJ 2586 Y2K Accounting Bug greedy difficulty :2

Y2K Accounting Bug Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10537   Accepted: 52 ...

3. poj 2586 Y2K Accounting Bug( Greedy Algorithm , A water title )

#include <iostream> using namespace std; /*248K 32MS*/ int main() { int s,d; while(cin>> ...

4. greedy POJ 2586 Y2K Accounting Bug

Title address :http://poj.org/problem?id=2586 /* The question : A company needs to make statistics on its annual profit , For every month , If it's profitable, it's profitable S, If you lose money, you lose money D. The company makes statistics every five months , All year round ...

5. poj 2586 Y2K Accounting Bug

http://poj.org/problem?id=2586 A company is in 12 Months , Or fixed surplus s, Or fixed loss d. But I can't remember which months of surplus , Which months of losses , Just remember the continuity 5 Months of algebra sum is always at a loss (<0 by ...

6. POJ 2586 Y2K Accounting Bug（ Enumerate flood problems ）

Y2K Accounting Bug Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10674   Accepted: 53 ...

7. POJ 2586 Y2K Accounting Bug（ Enumerate the big water problems ）

Y2K Accounting Bug Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10674   Accepted: 53 ...

8. [POJ 2586] Y2K Accounting Bug （ greedy ）

Topic link :http://poj.org/problem?id=2586 The main idea of the topic :( It's hard to read ) Here are two numbers for you ,s,d, intend MS The company may make money every month , Or you could lose money , If you make money , It's about making money s element , If you lose money , Just ...

9. POJ - 2586 Y2K Accounting Bug ( Looking for a regular )

Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for ...

## Random recommendation

1. Soil moisture sensor YL69 Use

1. Power Supply :3.3V ~ 5V 2. The way to get humidity information (2 It can be used at the same time ): From the sensor's D0 Pin : Soil moisture is greater than a certain threshold , be D0 Output 0, Otherwise output 1 From the sensor's A0 Pin : Get the analog quantity , More accurate . The higher the soil moisture is , ...

2. javascript new

1. only function have access to new 2. function Use new when , Can copy function in this To new objects , And will function Of prototype Point to a new object ( If it's time to function no ...

3. （ turn ）PK Series six ： Should I read professional books on Chinese translation

4. cvsnt Set user 、 Change Password

After forgetting the password , It can be used administrator Create a new user , Use this user's account . password agent Set up clear password So bad ..   cvsnt To configure Create user 1 . download cvs ...

5. Kindle PaperWhite3 Prison break and PDF Plug in installation

Download the tools you need The files shared here are all the files needed for this tutorial All tools download links :http://pan.baidu.com/s/1c249P2S password :ozc7 One . preparation This method of escape is only applicable to KO.KV ...

6. Docker Quick start

Docker It's been on fire for a long time , I plan to get familiar with it on Alibaba cloud recently Docker Related applications of , Prepare for future work . Basic concepts Docker Is based on Go Cloud open source project implemented by language , Born in 2013 Beginning of the year , The original initiator was do ...

7. 【BZOJ】 1041: [HAOI2008] The whole point on the circle

Topic link :http://www.lydsy.com/JudgeOnline/problem.php?id=1041 \${x^{2}+y^{2}=r^{2} }\$ \${\Rightarrow y^{2} ...

8. CAS Client Cluster environment Session Problems and solutions Can't log out