虫虫首页| 资源下载| 资源专辑| 精品软件
登录| 注册

您现在的位置是:虫虫下载站 > 资源下载 > 其他 > 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
  • 上传时间: 2014-01-12
  • 上传用户:GreatMarxist
  • 资源积分:2 下载积分
  • 标      签: 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.

相 关 资 源

您 可 能 感 兴 趣 的