• [1325] Where is My Cloth

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • TT spent long time to finish her job. They started their trip, soon they met a hard problem: there are many small demons in the way. Only fight can they continue. Seen the T-shirts her soldiers wear, TT decided to buy them some equipments to promote them. Every soldier need three things, weapon、shield and armour. The shop have N weapons 、M shields and T armours. Every equipment has a power number. TT should calculate a full equiped soldier's power. If two things have the same power, list by lexicographic order.
  • 输入
  • First there is N, M, T(1 <= N.M.T <= 300). Then followed N, M and T lines.each line contains a string S(1<= strlen(s) <= 20) and a power number P. All numbers is no more than integer.
  • 输出
  • For each case, first output "Case i:" in a single line. Next output the name of all full equiped soldier's equipment(three things) and the sum of power in a single line.
  • 样例输入
  • 3
    a 4
    b 2
    c 6
    3
    de 32
    fg 34
    hi 22
    2
    fe 4
    erf 57
    
  • 样例输出
  • Case 1:
    c fg erf 97
    a de fe 40
    
  • 提示
  • 来源
  • Mr.Cai
  • 操作

显示春菜