poj2586
来源:互联网 发布:python和php学哪个 编辑:程序博客网 时间:2024/05/17 03:57
//poj2586 读题好难,我都怀疑自己英语了。。。//给你盈利和亏损额度,每5个月发布一次,必须总的是亏的,但是保证亏的最少 1-5 2-6... //求这样下去12个月的最大盈利是多少 ?(虽然5个月都会亏, 但是连续下来时有可能盈利的) //wa了一次,没有考虑到全年都是亏损的情况 #include <iostream>#include <cmath>#include <string>using namespace std;int main(){int s, d;while(cin>>s>>d){int x, y;for(int i = 4; i >= 0; i--){//5个月一次循环的样子,所以5个月亏n次,代表了12个月会亏 2n次x = i;y = 5 - i;if(s * x < d * y) {break;} } int surplus = 0; if(x != 1 && x != 0) surplus = s * (12-2*y) - d * y * 2; else if(x == 1)surplus = s * 3 - 9 * d;else if(x == 0)surplus = -12 * d;if(surplus > 0){cout<<surplus<<endl;}elsecout<<"Deficit"<<endl;}return 0;}
0 0
- poj2586
- poj2586
- poj2586
- poj2586
- poj2586
- poj2586
- poj2586
- POJ2586
- POJ2586
- POJ2586
- poj2586
- poj2586
- poj2586
- poj2586
- POJ2586
- poj2586
- POJ2586
- POJ2586--贪心
- 使用C#作为客户端的PHP服务器上传文件
- datepick
- File类
- c#下载进度条
- 转自科学网:《评论:“副教授,我缺少的是什么?”》
- poj2586
- 程序员笑话1
- zookeeper集群的配置和测试
- Android 音频 Native API OpenSL ES 简要介绍
- [leetcode]Maximum Subarray
- 信号和槽使用时各种函数的实际调用顺序
- 黑马程序员---java基础语法1
- .NET 解释术语:CLR、FCL、IL、Assembly(程序集)
- zoj 3623 Battle Ships dp