Topic 1113: Two fork TreesBoth methods are used to solve the nature of the two-fork tree.time limit:1 secondsMemory limit:32 MB
Title Description:
As shown above, by positive integer ... Formed a special binary tree. We know that the last node of this binary tree is n. The question now is how many nodes are included in the subtree where node m is located.For example, n = 12,m = 3 Then the node in the 13,
Question
1113: [poi2008] Poster platime limit: 10 sec memory limit: 162 MB
Description
N rectangles are arranged in a row. Now we want to cover them with a small number of rectangular posters.Input
The first line gives the number N, which indicates that there are n rectangles. N is in the N rows under [1/2], and each line gives the length and width of the rectangle. Its value is in [] 2 posteringOutput
The minimum number of posters.Sample input5
Poj 1113 Wall (convex hull), poj1113wall convex hull
Link: poj 1113
Given n vertices of a polygon Castle, a wall is built around the outside of the castle to enclose all vertices,
And the distance between the wall and all vertices is at least L. Find the minimum length of the wall.
Idea: minimum length = the total side length of the convex hull formed by the castle vertex + the circle perimeter with a radiu
is also a basic requirement for the two-dimensional convex hull algorithm.
Generally, further computation can be performed only when the order is ensured.
ChangeCMP FunctionsWe can change the collinearity (fetch/not fetch) mentioned above and the order (clockwise/counterclockwise) here.
========================================================== ======================================
3. Convex Hull area and perimeter
A Simple Algorithm of convex hull is introduced.
Let's look at a sp
Question: http://poj.org/problem? Id = 1113 http://acm.hust.edu.cn/vjudge/contest/view.action? Cid = 22013 # Problem/fwall
Time limit:1000 ms
Memory limit:10000 K
Total submissions:26219
Accepted:8738
DescriptionOnce upon a time there was a greedy king who ordered his Chief implements ECT to build a wall around the king's castle. the king was so greedy, That he wocould not listen to his own ect's proposals to buil
Original question connection: http://poj.org/problem? Id = 1113
Give N points. You can see a wall so that the distance between all points and the wall is no less than l. Length of the wall ..
Idea: first obtain the convex hull of N points, and then build a wall based on the convex hull. One part of the wall is the convex hull length, and the other part is a circle with the radius of L !!
Code:
# Include
Title Description:
As shown above, by positive integer ... Formed a special binary tree. We know that the last node of this binary tree is n. The question now is how many nodes are included in the subtree where node m is located.For example, n = 12,m = 3 Then the node in the 13,14,15 and the subsequent nodes are not present, the node m is the subtree of the nodes included in the 3,6,7,12, so the node m in the subtree has 4 nodes.
Input:
The
that it is cast is the expected value of I.The final result of this state transfer equation is dp[0].#include #include#include#include#include#includestring.h>using namespacestd;intMain () {inti,n,t; Doubledp[101005]; CIN>>T; while(t--) {memset (DP,0,sizeof(DP)); CIN>>N; Dp[n-1]=6; Dp[n-2]=6; Dp[n-3]=6; Dp[n-4]=6; Dp[n-5]=6; Dp[n-6]=6; for(inti=n-7; i>=0; i--) { for(intj=1; j6; j + +) {Dp[i]+=dp[i+j]/6; } Dp[i]+=1; } printf ("%.2lf\n", dp[0]); } return 0;}Acdream
:=1 toN Do//ifI Thenf[i]:=100000000; Fillchar (H,sizeof (h),0); L:=0; R:=1; h[1]:=SS; V[SS]:=true; whileL Do beginInc (L); Q:=H[l]; TT:=First[q]; whileTt0 Do begin ifF[map[tt,1]]2] Then beginF[map[tt,1]]:=f[q]+map[tt,2]; ifF[map[tt,1]]>ans Thenans:=f[map[tt,1]]; if notV[map[tt,1]] Then beginInc (R); H[R]:=map[tt,1]; V[map[tt,1]]:=true; End; End; TT:=map[tt,3]; End; V[Q]:=false; End; End; proceduresearch; varIi:longint; begin forii:=1 toN Do ifF[ii]>ans Thenans:=F[ii]; End; beginrea
Base time limit: 3Second space limit: 131072 KB score: gives a matrix of n * n, where the elements are positive integers. The M-Order of the matrix is obtained.Because the M-time calculation results are too large, only the results of each mod (10^9 + 7) need to be output. InputLine 1th: 2 numbers n and m, separated by a space in the middle. n is the size of the matrix, M is the M-th square. (2 OutputTotal n rows, number of n per row, corresponding to the results of M-time mod (10^9 + 7).Inpu
Topic PortalTest instructions: To find the shortest route, so that any point on the line away from the castle at least L distanceAnalysis: Convex hull First, answer = length of convex hull + circumference of circle with L as radius/************************************************* author:running_time* Created time:2015/10/25 11:00:48* File N Ame:P oj_1113.cpp ************************************************/#include Simple geometry (convex package) POJ 1113
, he'll make the decision to become the Arrow.Now, Kuangbin wonders, the expectation of the time of the throwing dices.InputFirst line, the number of cases T In the next T lines, there would be T numbers.Every number is not bigger than 100000OutputEach test output a number rounded to the second digit.Sample Input11Sample Output6.00SourceWuyiqiManagerWuyiqiTitle Link: http://acdream.info/problem?pid=1113The main idea: Roll the dice, if the number of points before the throw and the current throw t
Acdream 1113 The Arrow (probability dp)
Question:
The initial state is 0. Each time a dice is dropped [], if it is in x, the number of dice is y, and if x + y> n, it is still in x.
Calculate the expected number of times the dice are dropped from 0 to n.
Analysis:
This is changed from the previous one: if the number of dice is y in x, and if the number of dice is y in x + y> n, the number of dice remains in x.
Then we set dp [I] to indicate the expect
1113: [Poi2008] Poster pla time
limit:10 Sec Memory limit:162 MBsubmit:765 solved:466[Submit] [Status] [Discuss]
Descriptionn rectangles, lined up in a row. Now you want to cover them with as few rectangular posters as possible.InputThe first line gives the number n, which means there are n rectangles. N under [1,250000] n rows, each row gives the length and width of the rectangle. Its value in [1,1000000000]2 posteringOutputThe minimum numbe
Link: poj 1113 monotonic link convex bag Summary
Question: we still use a convex bag to find the shortest perimeter. We only need to add the length of a circle. We can apply the template to solve this problem;
AC code:
1 # include
Poj 1113 wall convex hull Application
Label: Map string
Http://acm.hdu.edu.cn/showproblem.php? PID = 1, 1113
Problem description
In millions of newspapers initialize ss the United States there is a word game called jumble. the object of this game is to solve a riddle, but in order to find the letters that appear in the answer it is necessary to unscramble four words. your task is to write a program that can unscramble words.Input
The input contains four parts:1. a dictionary, which consi
[i][1] =6*DP[I-1][1]+5*DP[I-1][0] =6*T[I-1]-DP[I-1][0] =6*t[i-1]-t[i-2] According to S[i]=s[i-1]+t[i] can be calculated: s[i]=s[i-1]+ 6*t[i-1]-t[i-2] Then there are formulas: Set r=, get it done! Summary: The application of the matrix, carefully study the above structure matrix and derivation process, the first method of constructing the block matrix is very useful , it is not good for the SN formula directly constructs the matrix. But if the formula such as above s[i]=s[i-1]+ 6*t[i-1]-t[i-2]
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.