poj 贪心相关之 Y2K Accounting Bug2586
题意真的很难懂……
#include<iostream>
#include<cstring>
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
int s, d;
int main()
{
//freopen("1.txt", "r", stdin);
int cost;
while (scanf("%d%d", &s, &d) != EOF)
{
if (4 * s < d)
//SSSSDSSSSDSS
cost = 10 * s - 2 * d;
else if (3 * s<2 * d && 4 * s>d)
//SSSDDSSSDDSS
cost = 8 * s - 4 * d;
else if (2 * s<3 * d && 3 * s>2 * d)
//SSDDDSSDDDSS
cost = 6 * s - 6 * d;
else if (s<4 * d && 2 * s>3 * d)
//SDDDDSDDDDSD
cost = 3 * s - 9 * d;
else
cost = -1;
if (cost > 0)
printf("%d\n", cost);
else
printf("Deficit\n");
}
}