POJ - 2586 Y2K Accounting Bug (找规律)】的更多相关文章

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 In…
题目地址:http://poj.org/problem?id=2586 /* 题意:某公司要统计全年盈利状况,对于每一个月来说,如果盈利则盈利S,如果亏空则亏空D. 公司每五个月进行一次统计,全年共统计8次(1-5.2-6.3-7.4-8.5-9.6-10.7-11.8-12), 已知这8次统计的结果全部是亏空(盈利-亏空<0).题目给出S和D,判断全年是否能盈利, 如果能则求出盈利的最大值,如果不能盈利则输出Deficit 贪心 or 枚举 1. 贪心抓住亏损的月尽量在5个月的后面,这样可以被…
http://poj.org/problem?id=2586 大意是一个公司在12个月中,或固定盈余s,或固定亏损d. 但记不得哪些月盈余,哪些月亏损,只能记得连续5个月的代数和总是亏损(<0为亏损),而一年中只有8个连续的5个月,分别为1~5,2~6,…,8~12 问全年是否可能盈利?若可能,输出可能最大盈利金额,否则输出“Deficit". 贪心,符合最优子结构性质.5个月统计一次都亏空,那么有5种情况:       1.若SSSSD亏空,那么全年可能最大盈利情况为: SSSSDSSS…
Y2K Accounting Bug Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8678   Accepted: 4288 Description Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for preparing annual report for MS Inc.…
Y2K Accounting Bug Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10674   Accepted: 5344 Description Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for preparing annual report for MS Inc…
Y2K Accounting Bug Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10537   Accepted: 5264 Description Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for preparing annual report for MS Inc…
Y2K Accounting Bug Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10674   Accepted: 5344 Description Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for preparing annual report for MS Inc…
题目链接:http://poj.org/problem?id=2586 题目大意:(真难读懂啊)给你两个数,s,d,意思是MS公司每个月可能赚钱,也可能赔钱,如果赚钱的话,就是赚s元,如果赔钱的话,就是陪d元.现在告诉你只要是连续的5个月,就亏钱(亏多少不知道),问你MS公司全年能够赚多少钱,如果赚不了钱的话,就输出“Deficit” 贪心:我们说,输出的最终结果是f(x,y)=x*s-y*d,也就是说现在要求得x,y使得f(x,y)具有最大值. 当s,d,x+y给定时,x越大,则赚的钱越多.…
题目连接:http://poj.org/problem?id=2586 题意:次(1-5.2-6.3-7.4-8.5-9.6-10.7-11.8-12),次统计的结果全部是亏空(盈利-亏空<0).题目给出S和D,判断全年是否能盈利,如果能则求出盈利的最大值,如果不能盈利则输出Deficit 解析: 全年的盈亏情况可以由前五个月直接决定1.若SSSSD亏空,那么全年最优情况为SSSSDSSSSDSS 2.若SSSDD亏空,那么全年最优情况为SSSDDSSSDDSS 3.若SSDDD亏空,那么全年最…
#include <iostream> using namespace std; /*248K 32MS*/ int main() { int s,d; while(cin>>s>>d) { int count=0; for(int i=5;i>0;i--) { if(s*i<(5-i)*d) { count=i; break; } } int total=s*count-d*(5-count); total*=2; if(count>=2) tota…
1.Link: http://poj.org/problem?id=2586 2.Content: Y2K Accounting Bug Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10520   Accepted: 5257 Description Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some…
链接: http://poj.org/problem?id=2586 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=26733#problem/C Y2K Accounting Bug Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8472   Accepted: 4185 Description Accounting for Computer Machini…
链接: http://poj.org/problem?id=2586 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=26733#problem/C Y2K Accounting Bug Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8472   Accepted: 4185 Description Accounting for Computer Machini…
Y2K Accounting Bug Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10024 Accepted: 4990 Description Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for preparing annual report for MS Inc. Al…
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…
Y2K Accounting Bug Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11297   Accepted: 5686 Description Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for preparing annual report for MS Inc…
Y2K Accounting Bug Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11222   Accepted: 5655 Description Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for preparing annual report for MS Inc…
转载请注明出处:http://blog.csdn.net/u012860063?viewmode=contents 题目链接:http://poj.org/problem?id=2586 ---------------------------------------------------------------------------------------------------------------------------------------------------------- 欢…
[POJ2586]Y2K Accounting Bug 试题描述 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…
Y2K Accounting Bug Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10945   Accepted: 5499 Description Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for preparing annual report for MS Inc…
Y2K Accounting Bug   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…
Y2K Accounting Bug Time Limit: 1000MS Memory Limit: 65536K 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. pos…
Y2K Accounting Bug Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9691   Accepted: 4838 Description Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for preparing annual report for MS Inc.…
  Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11271   Accepted: 5672 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 r…
题目: 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…
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 mont…
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 mont…
题目链接 题意 : 给你一个蜂巢状图形,让你找出两个点之间的距离. 思路 : 在做这个题之前可以看一下2265,因为是一种题来着,规律就是我在2265里写的那样,然后就是求距离了,求距离的时候只需考虑两个点的坐标差值(x,y),把坐标差值分成四个项限,x>0且y>0,或x<0且y<0为abs(x+y),其他情况则是max(abs(x),abs(y)).. #include <cstdio> #include <cstring> #include <io…
链接:http://poj.org/problem?id=2586 题意:大意是一个公司在12个月中,或固定盈余s,或固定亏损d.但记不得哪些月盈余,哪些月亏损,只能记得连续5个月的代数和总是亏损(和<0算亏损),问全年是否可能盈利?若可能,输出可能最大盈利金额,否则输出“Deficit". 题解:看了网上的题解,基本上都说是贪心,但我不知道怎样贪心,只不过按自己的想法去做(做的时候不够细心,忽略了细枝末节).由于连续5个月必须亏损,所以就但看5个月内,亏损最少的情况,是1*d与4*s,是…
题目链接 题意 : 给你两个蜂巢的编号,给你一个的编号让你输出在另外一个蜂巢中对应的编号. 思路 : 先将蜂巢分层,第一层一个数,第二层6个数,第三层12个数…………然后用公式表示出第n层的最后一个数是多少,下图中竖着的是x坐标,斜着的是y坐标,往左横坐标+1,往右横坐标-1,以斜线为准往上纵坐标-1,往下纵坐标+1,(1,1)也就是18是第三圈的第一个数,(2,1)也就是20是第四圈的第一个数. #include <cstdio> #include <cstring> #incl…