NA_3_02

所属分类:其他
开发工具:C/C++
文件大小:1KB
下载次数:41
上传日期:2008-10-02 16:03:21
上 传 者anthonychan
说明:  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.

文件列表:
NA_3_02.c (1305, 2008-10-01)

近期下载者

相关文件


收藏者