POJ 2856 Y2K Accounting Bug【简单暴力】
链接:
| Time Limit: 1000MS | Memory Limit: 65536K | |
| Total Submissions: 8472 | Accepted: 4185 |
Description
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
Output
Sample Input
59 237
375 743
200000 849694
2500000 8000000
Sample Output
116
28
300612
Deficit
Source
题目:

思路:
code:
#include<stdio.h>
int main()
{
int s, d;
while(scanf("%d%d", &s,&d) != EOF)
{
int ans = -1;
if(4*s < d) ans = 10*s-2*d; //ssssd
else if(3*s < 2*d) ans = 8*s-4*d; //sssdd
else if(2*s < 3*d) ans = 6*s-6*d; //ssddd
else if(s < 4*d) ans = 3*s-9*d; //sdddd
if(ans < 0) printf("Deficit\n");
else printf("%d\n", ans);
//for(int i = 1; i <= 12; i++) printf("%d\n", i*s-(12-i)*d);
} return 0;
}
POJ 2856 Y2K Accounting Bug【简单暴力】的更多相关文章
- 贪心 POJ 2586 Y2K Accounting Bug
题目地址:http://poj.org/problem?id=2586 /* 题意:某公司要统计全年盈利状况,对于每一个月来说,如果盈利则盈利S,如果亏空则亏空D. 公司每五个月进行一次统计,全年共统 ...
- POJ 286 Y2K Accounting Bug【简单暴力】
链接: http://poj.org/problem?id=2586 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=26733#probl ...
- poj 2586 Y2K Accounting Bug
http://poj.org/problem?id=2586 大意是一个公司在12个月中,或固定盈余s,或固定亏损d. 但记不得哪些月盈余,哪些月亏损,只能记得连续5个月的代数和总是亏损(<0为 ...
- poj 2586 Y2K Accounting Bug (贪心)
Y2K Accounting Bug Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8678 Accepted: 428 ...
- POJ 2586 Y2K Accounting Bug(枚举洪水问题)
Y2K Accounting Bug Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10674 Accepted: 53 ...
- POJ 2586 Y2K Accounting Bug 贪心 难度:2
Y2K Accounting Bug Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10537 Accepted: 52 ...
- POJ 2586 Y2K Accounting Bug(枚举大水题)
Y2K Accounting Bug Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10674 Accepted: 53 ...
- POJ - 2586 Y2K Accounting Bug (找规律)
Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for ...
- [POJ 2586] Y2K Accounting Bug (贪心)
题目链接:http://poj.org/problem?id=2586 题目大意:(真难读懂啊)给你两个数,s,d,意思是MS公司每个月可能赚钱,也可能赔钱,如果赚钱的话,就是赚s元,如果赔钱的话,就 ...
随机推荐
- SparkSQL的3种Join实现
引言 Join是SQL语句中的常用操作,良好的表结构能够将数据分散在不同的表中,使其符合某种范式,减少表冗余.更新容错等.而建立表和表之间关系的最佳方式就是Join操作. 对于Spark来说有3中Jo ...
- ASP.NET MVC学习---(八)三个比较常用的方便的功能
通过之前的了解 现在我们已经可以使用mvc进行一些简单的开发 但是还不够 哪里不够呢? 为什么现在的程序员喜欢用mvc进行开发 不就是因为它爽吗? 之前介绍的那些特点仅仅是mvc框架的一小部分 只是一 ...
- ASP.NET MVC学习---(四)MVC初窥
前面三篇大幅度的介绍了EF框架 这并不是没有道理的 现在使用mvc开发一般都离不开ef 因为它们相结合可以为你带来完美的体验 当然 前面所描述的仅仅是ef框架的冰山一角 它是一门学问很深的功课 如果你 ...
- bitcoin-qt忘记密码
客户端有钱包加密功能,输入密码可以增强安全性. 但是,如果你把钱包文件弄丢了,那即使设了密码,币也会丢. 关闭bitcoin-qt,把钱包文件wallet.dat 剪到其他地方(但不要删除),然后重新 ...
- Android面试题3之描写叙述下Android的系统架构
描写叙述下Android的系统架构: Android系统从下往上分为Linux内核层(linux kerner),执行库(runtime library),应用程序框架层,应用程序层 linuxker ...
- 内网IPC$种马的三种方法
copy muma.exe \\host\c$\windows\temp\foobar.exe ##IPC拷贝木马文件 WMIC远程运行命令 wmic /node:host /user:adminis ...
- Oracle 修改表名
.ALTER TABLE T_PLAT_KEYWORD_STATISTIC RENAME TO T_PLAT_KEYWORD; .create new_table as select * from o ...
- E - Hangover(1.4.1)
Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64u Submit cid=1006#sta ...
- oracle中sql执行性能关注点
繁琐复杂的执行计划.可能迷了开发人员的眼.导致一条性感又傻X的SQL 在服务器上跑得特欢乐 有介于此.重点抓住几个部分.至于其他的嘛.当然是.非礼勿视咯.. ㈠ 返回行的数量 ...
- linux把某个文件拷贝到不同的目录下面
find -name '7*' -type d|xargs -n 1 cp PBClassname.properties