题意:给定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
1 题目描述: 被给一系列的正整数x1,x2,x3...xn和两个非负整数a和b,通过下面两步操作将a转化为b: 1.对当前的a减1. 2.对当前a减去a % xi (i=1,2...n). 计算a转化到b最小需要的最短步数. 2 输入 第一行包含简单的整数n(1 ≤ n ≤ 10^5),第二行包含n个用空格分开的整数x1,x2,x3...xn(2 ≤ xi ≤ 10^9),第三行包含两个整数a和b(0 ≤ b ≤ a ≤ 10^9, a - b ≤ 10^6). 3 输出 输出一个整数
C. Epidemic in Monstropolis time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There was an epidemic in Monstropolis and all monsters became sick. To recover, all monsters lined up in queue fo
D. Exams time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasiliy has an exam period which will continue for n days. He has to pass exams on m subjects. Subjects are numbered from 1 to m. Ab
UVALive - 3902 Network Consider a tree network with n nodes where the internal nodes correspond to servers and the terminal nodes correspond to clients. The nodes are numbered from 1 to n. Among the servers, there is an original server S which provid
C. Bits time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Let's denote as the number of bits set ('1' bits) in the binary representation of the non-negative integer x. You are given multiple que