题意:给定N个物品的重量Li 背包的容量M 同时要求每个背包最多装两个物品 求至少要多少个背包才能装下所有物品 简单贪心 注意输出: #include<bits/stdc++.h> using namespace std; #define N 200000+5 int n,w; int a[N]; int main() { int cas;cin>>cas; while(cas--) { cin>>n>>w; ;i<n;i++) scanf(&qu…
Wooden Sticks Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 15564 Accepted Submission(s): 6405 Problem Description There is a pile of n wooden sticks. The length and weight of each stick a…
FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 56784 Accepted Submission(s): 19009 Problem Description FatMouse prepared M pounds of cat food, ready to trade with the cats g…
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships consists of bconsecutive cells. No cell can be part of two ships, however, the shi…