Question Link
Question: Give You N points to determine the number of convex quadrants that can be formed.
Idea: If a concave quadrilateral is formed, it indicates that a point is inside the triangle connected by the other three points. In this way, you only need to determine the area of the three triangles connected to each of the other three points and the area of the triangle composed of the other three points.
I forgot to add FABS in the middle, an
The K-Large is n-k+1 small, so you can answer the two points (Jianggo said a similar question)The two-point answer finds the coordinates of the position of the number that is smaller than the current answer, determines whether the n-k+1 number that satisfies the same column in the same row can be selected, and then runs Hungary, and for a coordinate (x, y) if the current answer to A[x][y]≤a[x][y is met, the line x is connected to the Y column, Then run Hungary to determine if the maximum match i
#include 6#include 7#include 8 using namespacestd;9 #defineMAXN 1010Ten One struct Point A { - Doublex, y; -Point (Doublex=0,Doubley=0): X (x), Y (y) {} the }; - - typedef point Vector; - Point P[MAXN]; + - intn,l; + Const DoublePi=3.1415926535898; A at DoubleMyabs (Doublex) {returnx0?-x:x;} - - Const Doubleeps=1e-Ten; - intDCMP (DoubleX//judging plus or minus and 0 - { - if(Myabs (x) return 0; in Else returnx0?-1:1; - } toVectoroperator-(point A,point B) {returnVector (a.x-b.x,
0
Sample output
0 02 33 0
The following: the use of the characteristics of the difference, if the difference is negative is a clockwise turn, if it is counterclockwise, if the 0 is a common line;Code:1#include 2#include 3#include 4#include 5#include 6 using namespacestd;7 structnode{8 intx, y;9Friendint operator(Node A,node b) {Ten if(a.xreturn 1; One Else return 0; A } - }; - intChaji (Node a,node b,node c)
first line of a multiple input was an integer N and then a blank line followed by N input blocks. Each input block was in the format indicated in the problem description. There is a blank line between input blocks.The output format consists of N output blocks. There is a blank line between output blocks.Sample Input19 100200 400300 400300 300400 300400 400500 400500 200350 200200 200Sample Output1628 Sourcenortheastern Europe 2001/* ***********************************************author:ckbosscr
Topic Link: Click to open the linkFirst you have to n-=2, and then there is a Cattleya number.The previous question was H (n) = h (n-1) * (4n-2)/(n+1);The problem is h (n) = (2n)! * n! /(n+1)!;Then the factorial decomposition factorization:Click to open linkThe direct fast power is broken down.#include Hnu 13101 The Triangle division of the convex Polygon Cattleya number nth%m (M can be non-prime
HDOJ 1348 Wall convex hull
Wall
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission (s): 4001 Accepted Submission (s): 1131
Problem Description Once 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 build a beautiful brick wall with a perfect shape and nice tal
of farms.Input* Line 1: A single integer, n* Lines 2. n + 1: two space-separated integers x and y specifying coordinate of each farmOutput* Line 1: A single integer that is the squared distance between the pair of farms that are farthest apart from each other.Sample Input40 00 11 11 0Sample output2HintFarm 1 (0, 0) and farm 3 (1, 1) have the longest distance (square root of 2)SourceUsaco 2003 fall
Find the vertices on the convex hull, and the
Copy Code code as follows:
Take HDU2108 For example, go to AC bar.
Point in reverse order input
Import Java.util.Scanner;
1s
public class HDU2108 {
public static void Main (string[] args) {
Scanner sc = new Scanner (system.in);
while (true) {
int x,y;
int n = sc.nextint ();
if (0==n) {
Break
}
Point[] p = new Point[n];
for (int i=0; iP[i] = new Point ();
}
for (int i=0; ix = Sc.nextint ();
y = Sc.nextint ();
P[i] = new Point (x,y);
}
Polygons
Boolean tag = true;
int j,
The main effect of the topic:To two convex polygons, to find the area of intersection.
Topic Analysis:Ask for a half plane turn.
The code is as follows:
#include
Geometry problem Ah, is said to be bare half plane, but I still WA several hair.
The probability of a point in a polygon that is smaller than the other edge by a certain point, (with Range/total area).
Then you can set the point for (X,y), to all sides of the area to express, and then establish unequal relationships, after the reduced point we can get a series of inequalities on X,y, such as Ax+by
However, there are two bugs I did not consider, one is to ensure (x,y) points in the
The area of the convex polygon and seems to have a lot of way, the Net has O (N^2LOGN) algorithm, the nest will only O (N^3LOGN) scan line violence (seems to be able to do O (n^3) is to solve. The endpoints of all triangles and intersections are sorted together so that all the images are divided into several intervals, each area of which is a number of trapezoidal (triangles can also be used as a trapezoid), and then the total length of the median lin
WA a half-day result is a quick row to double keyword sorting. 囧
Main topic:
Once there was a king, the king was greedy, and then let a fence, this fence requires the least material, and distance from the castle. Give you the coordinates of the castle. Let you output this minimum length.
Brief:
It's actually a convex hull + a circumference length with a radius of L.
Attached code:
Program pku_1113; var a,b,c:array[0..3000] of Longint; N,r:longint; {--
Lap PoolTime limit: Ms | Memory limit: 65535 KB Difficulty: 4 Description There is a pasture with a lot of water supply, and now the owner of the ranch wants to use a fence to circle the water supply, to prevent their livestock from drinking, and each pool has its own coordinates. Now you need to write a program that uses the shortest fence to circle these water supply units. (Fence is large enough and variable in length) enter N for the first line, representing the test data in N Group (1The se
First, the question description
Given a convex polygon with n (n
Input file: Number of vertices in first row n
Weights for n vertices in the second row (from 1 to N)
Output format: Minimum and value
The way the triangles are composed
Input Example: 5
122 123 245 231
Output example: the minimum is:12214884
The formation of 3 triangle:
3 4 5, 1 5 3, 1 2 3
Second, analysis of test questions
This is a typical dynamic programming problem. Set F[i,j] (I
F[
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.