1185: Unequalled Consumption
内存限制:64 MB
时间限制:1.000 S
评测方式:文本比较
命题人:
提交:1
解决:0
题目描述

输入
The input consists of several data sets (at most 20). Each data set consists of four lines. The first line contains an integer 1 ≤ n ≤ 5, the number of candy types. The next line contains n integers w1, ..., wn, where 1 ≤ wi ≤ 10 is the weight (in grams) of the i:th candy type. The third line contains an integer 1 ≤ q ≤ 10, the number of queries. The last line of a data set contains q integers P1, ..., Pq, where 1 ≤ Pj ≤ 1015 is the j:th query. Input is terminated by an incomplete data set where n = 0, which should not be processed.
输出
For the i:th data set, write a line "Set i", followed by q lines giving, for each query Pj, the minimal possible positive weight Wj (in grams) of a candy box. If there is no weight Wj such that at least Pj candy boxes can be made, print "no candy for you" for that query. You may assume that Wj, if it exists, will be at most 100 · Pj.
样例输入 复制
3
5 5 10
1
4
4
3 1 4 2
2
142 700
1
10
1
100
0
样例输出 复制
Set 1
10
Set 2
23
42
Set 3
no candy for you