• [D] Divide The Apples

  • 时间限制: 3000 ms 内存限制: 65535 K
  • 问题描述
  • XP and EG both like eating apple. This day they bought a lot of apples. Then it was time for them to seperate these apples. They didn't want to get less apples than each other and cut the apples into pieces either. So they would get equal weight of apples. After they seperated the apples, the rest would be throw away. for example they bought 5 apples, their weight are 1 2 3 5 6 , XP will get apple of weight 1 2 and EG 3 , the rest of 5,6 will be throw away. The total weight they get is 3. But there is another better way. XP get the apples of weight 2 6 and EG 3 5 , the total weight the get is 8, and this is the best way. But they didn't know how to seperate the apples. So they ask you for help to get as many apples as possible.
  • 输入
  • The first contain a positive integer n indicate the number of apple(1<=n<=100). you can sure the total weight of the apple won't exceed 2000.
    The second line contain n integers indicate the weight of each apple.
  • 输出
  • A integer m,indicate the maximal weight XP and EG can get.
  • 样例输入
  • 5
    1 2 3 5 6
  • 样例输出
  • 8
  • 提示
  • 来源
  • 加多宝凉茶
  • 操作

显示春菜