首页| 行业标准| 论文文档| 电子资料| 图纸模型
购买积分 购买会员 激活码充值

您现在的位置是:团子下载站 > 其他 > For solving the following problem: "There is No Free Lunch" Time Limit: 1 Second Memory Limit: 3

For solving the following problem: "There is No Free Lunch" Time Limit: 1 Second Memory Limit: 3

  • 资源大小:2 K
  • 上传时间:2021-05-26
  • 下载次数:0次
  • 浏览次数:33次
  • 资源积分:1积分
  • 标      签: Limit following solving problem

资 源 简 介

For solving the following problem: "There is No Free Lunch" Time Limit: 1 Second Memory Limit: 32768 KB One day, CYJJ found an interesting piece of commercial from newspaper: the Cyber-restaurant was offering a kind of "Lunch Special" which was said that one could "buy one get two for free". That is, if you buy one of the dishes on their menu, denoted by di with price pi , you may get the two neighboring dishes di-1 and di+1 for free! If you pick up d1, then you may get d2 and the last one dn for free, and if you choose the last one dn, you may get dn-1 and d1 for free. However, after investigation CYJJ realized that there was no free lunch at all. The price pi of the i-th dish was actually calculated by adding up twice the cost ci of the dish and half of the costs of the two "free" dishes. Now given all the prices on the menu, you are asked to help CYJJ find the cost of each of the dishes.
VIP VIP