Label: style blog color Io OS for SP Div log
# Include
HDU 2191 mourns the victims of the 512 Wenchuan earthquake-Cherish the present and be grateful for your life (multiple backpacks)
Topic Link Http://codeforces.com/contest/1058/problem/CThis problem is still the most convenient for violence, and the situation is most n*a[i] 900 species try each one again1#include 2 using namespacestd;3 intN;4 strings;5 BOOLCheckintx)6 {7 8 intsum=0, cnt=0;9 for(intI=0; i)Ten { Onesum+= (s[i]-'0'); A if(sum==x) - { - thesum=0; cnt++; - } - Else if(sum>x) - { + - return false; + } A } at if(sum!=0)return false;
Title Link: http://acm.hdu.edu.cn/showproblem.php?pid=2187Questions Jane asked:Problem Solving Ideas:Given the total amount of money and the kind of altogether1. To the given rice, according to the price of ascending, that is, the cheapest rice to the top2. If the current rice unit Price * Quantity > Total amount, then can buy sum+= total money/Unit PriceOtherwise sum+= the total weight of the current rice, while the total amount of money = Rice Unit Price * Quantity.3. Output sum, note the form
http://acm.hdu.edu.cn/showproblem.php?pid=2191Chinese topic, do not say nonsense ...Analysis: The problem is a multi-pack, but can be used 01 backpack to do, each kind of rice has a few bags a separate storage, so it becomes 01 backpack ...#include #include#includestring.h>#includestring>#include#include#include#include#include#includeusing namespacestd;#defineMet (A, b) memset (A, B, sizeof (a))#defineMAXN 2500#defineINF 0x3f3f3f3fConst intMOD = 1e9+7; typedefLong LongLL;intDP[MAXN];structnode{
Sometimes I feel like I'm a train of thought.This question first said to ask is the number of good interval, a good interval satisfies the condition: 1, the number of bits 1 and 2 for even, W[i] for a[i] binary 1, sum[i] = w[1] + ... + w[i], for any position l-r] Set a dp[n][2] array, dp[i][0] represents the end of I, the number of binary 1 in the interval and the number of intervals for even numbersDP[I][1] Represents the end of I, the number of binary 1 in the interval and the number of odd in
Input data first contains a positive integer c, which indicates that there is a C set of test cases, the first line of each set of test cases is two integers n and m (1Output for each set of test data, export the maximum weight that can be purchased for rice, and you can assume that you are spending more than all of the rice, and you can afford to spend it. The output for each instance takes up one row.Sample Input18 22 100 44 100 2Sample Output400#include HDU2191 Mourning
For survivors of the disaster, the most urgent is to solve the problem of food and clothing, the relief forces on the one side of the organization to get through the traffic, while organizing the procurement of grain. Now assume that a certain amount of relief funds to go to the market to buy rice (in bulk). If the market has m species of rice, the price and weight of various rice is known, ask, in order to meet the needs of more victims, the maximum amount of rice can be purchased?Input data fi
The question is as follows. I have had several backpack problems over the past few days.
Code It's similar to what I wrote yesterday. I just changed the code a little. HDU
1059 01 backpack + full backpack = multiple backpacks
) Mourning for the victims of the 512 Wenchuan earthquake-Cherish the present and be grateful for your life
Time Limit: 1000/1000 MS (Java/others) memory limit: 32768/32768 K (Java/Others)Total submission (s): 8039 accepted sub
Test instructions: Donations starting from 0, no more than m yuan each time, the first to achieve N wonIdea: the equivalent of starting from N, each time to take no more than M, the first to achieve 0 win. (Bash Game)#include #includeusing namespacestd;intMain () {intc,n,m; scanf ("%d",c); while(c--) {scanf ("%d%d",n,m); if(n% (m+1)!=0) printf ("grass\n"); Elseprintf"rabbit\n"); } return 0;}View CodeHDU 2188 Tribute to 512 Wenchuan earthquake vict
How to add SWAP partitions for 512 m Centos
This tutorial uses centos as an example to add swap memory to a LINUX server with small memory.
1. Create a cache file directory or directly go to the var directory:
Cd/var
2. Obtain the SWAP file block. Here we use 1G as an example.
Dd if =/dev/zero of = swapfile bs = 1024 count = 1038336
3. Create a SWAP file
/Sbin/mkswap swapfile
4. Activate the SWAP file
/Sbin
BFS to serialize.Similarly, we can also use DFS for serialization, the result of DFS serialization is as follows: [1,2,#,#,3,4,#,#,5,#,#], minus the end of the # to get [1,2,#,#,3,4,#,#,5], than BFS serialization results are longer. The main reason is that most of the # appears at the bottom, so the BFS way can make as many # as possible in the tail of the serialization.The process of deserialization, there is no more explanation.Interviewer AngleThe so-called serialization is to turn a structu
InputThe input data first contains a positive integer c, which indicates that there is a C set of test cases, the first line of each set of test cases is two integers n and m (1The amount of money and the type of rice, then the M-row data,Each line contains 3 numbers of P,h and C (1OutputFor each set of test data, output the maximum weight that can be purchased for rice, and you can assume that you are spending more than all of the rice, and you can afford to spend it. The output for each instan
, they make us keep making progress and efforts.Likewise, we would like to thank the pain and hardship brought to our wealth ~
Input data first contains a positive integer c, which indicates that there is a C set of test cases, the first line of each set of test cases is two integers n and m (118 22 100 44 100 2Sample Output400AUTHORLCYSOURCE2008-06-18 "ACM Program Design" Final Exam--Sichuan refueling! China Refueling!ideas: 01 Backpack deformation, multi-pack, each item number is not nec
Mourning for the victims of the 512 Wenchuan earthquake-selecting volunteers
Time Limit: 1000/1000 MS (Java/others) memory limit: 32768/32768 K (Java/Others)Total submission (s): 1858 accepted submission (s): 1050 Problem description: people throughout the country have extended a helping hand to help Sichuan compatriots suffer from disasters. Almost every province and city has sent a large number of rescue personnel, including the rescue and relief a
; jIdea 2:for (j=1; jfor (K=_v; k>=j*c[i];--k)Take a look at these two loops,C[i] K _v----------------------1 | . . . . . || . . . . |J | . . . || . . |m | . |---------------------()The cycles of the two loops are the same and are all in the matrix '. ' , that is, the same number of calculations, the same complexity of time2.2 Binary split, there are n pieces a goods, then split into 1,2,4,8,..., Q So, that is 1+2+4+...+q=nCode 3:#include #include#includestring.h>using namespacestd;intdp[ the];i
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.