首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > 其他 > Tug of War(A tug of war is to be arranged at the local office picnic. For the tug of war, the picnic

Tug of War(A tug of war is to be arranged at the local office picnic. For the tug of war, the picnic

  • 资源大小:2 K
  • 上传时间:2022-08-29
  • 下载次数:1次
  • 浏览次数:1次
  • 资源积分:1积分
  • 标      签: picnic the tug war

资 源 简 介

Tug of War(A tug of war is to be arranged at the local office picnic. For the tug of war, the picnickers must be divided into two teams. Each person must be on one team or the other the number of people on the two teams must not differ by more than 1 the total weight of the people on each team should be as nearly equal as possible. The first line of input contains n the number of people at the picnic. n lines follow. The first line gives the weight of person 1 the second the weight of person 2 and so on. Each weight is an integer between 1 and 450. There are at most 100 people at the picnic. Your output will be a single line containing 2 numbers: the total weight of the people on one team, and the total weight of the people on the other team. If these numbers differ, give the lesser first. )

相 关 资 源

您 可 能 感 兴 趣 的

同 类 别 推 荐

VIP VIP