ural 1058 chocolate

Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u

Submit Status Practice URAL 1058

Description

Fishburg confectionery factory produces convex polygon-shaped chocolates. Little Boy and Karlsson bought one and wanted to break it into two fragments. The areas of the fragments must be equal. Create a code to find out the length of breakage-line of a minimal length using the given chocolate form.

Input

The first line of input contains an integer N — the number of polygon vertices (4 ≤  N ≤ 50). The other N lines contain coordinates of the vertices in the counter-clockwise order. Coordinates are real numbers from −100 to 100 and given with at most 3 digits after decimal point.

Output

Output should contain the minimal length of breakage-line with accuracy to 0.0001.

Sample Input

input output
4
0 0
4 0
4 3
0 3
3

1 #include <stdio.h>

时间: 2024-09-29 04:38:30

ural 1058 chocolate的相关文章

URAL 1639 Chocolate 2 (博弈论)

1639. Chocolate 2 Time limit: 1.0 second Memory limit: 64 MB Little Boy is mad at Karlsson, who ate all the sweets in the flat and even went to the neighbours to eat their sweets too. Now Little Boy's parents brought home a chocolate bar, and, sure e

ural 1217. Unlucky Tickets

1217. Unlucky Tickets Time limit: 1.0 secondMemory limit: 64 MB Strange people live in Moscow! Each time in the bus, getting a ticket with a 6-digit number, they try to sum up the first half of digits and the last half of digits. If these two sums ar

codeforces 598E E. Chocolate Bar(区间dp)

题目链接: E. Chocolate Bar time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You have a rectangular chocolate bar consisting of n × m single squares. You want to eat exactly k squares, so you ma

Ural 1081 Binary Lexicographic Sequence(DP)

题目地址:Ural 1081 先用dp求出每个长度下的合法序列(开头为1)的个数.然后求前缀和.会发现正好是一个斐波那契数列.然后每次判断是否大于此时长度下的最少个数,若大于,说明这一位肯定是1,若小于,则肯定是0.就这样不断输出出来即可. 代码如下: #include <iostream> #include <cstdio> #include <string> #include <cstring> #include <stdlib.h> #in

URAL 1684. Jack&#39;s Last Word KMP

题目来源:URAL 1684. Jack's Last Word 题意:输入a b 把b分成若干段 每一段都是a的前缀 思路:b为主串 然后用a匹配b 记录到b的i位置最大匹配的长度 然后分割 分割的时候要从后往前 如果a = abac b = abab 那么如果从前往后 首先覆盖了aba 然后b就不能覆盖了 从后往前就可以了 首先覆盖ab 下一次还是ab 因为已经记录了到i位置的最大匹配长度 根据长度从末尾倒退 每次倒退的时候只要是最大的匹配的长度 因为如果在某一次的递推 记录的最大匹配的前缀

[BZOJ 1058][ZJOI2007]报表统计

题目:http://www.lydsy.com/JudgeOnline/problem.php?id=1058 题解 方法一:离线+离散化+线段树. 这个方式的常数太大,会T.我在洛谷跑最后两个点TLE了,在BZOJRE了. 具体说一下怎么做吧.首先把所有数离散化,把出现过的绝对值离散化.这样我们就能得到约n+m个数和n+m个绝对值.然后,维护两颗线段树,记录数据是否出现,并记录区间出现的最大值和最小值(因为在线段树上的点是从大到小的,假设我们添加了元素k,然后我们找它的数据排位(下标)),每添

ural 1272. Non-Yekaterinburg Subway

1272. Non-Yekaterinburg Subway Time limit: 1.0 secondMemory limit: 64 MB A little town started to construct a subway. The peculiarity of the town is that it is located on small islands, some of them are connected with tunnels or bridges. The mayor is

ural 1273. Tie

1273. Tie Time limit: 1.0 secondMemory limit: 64 MB The subway constructors are not angels. The work under the ground and… Well, they are not angels. And where have you seen angels? It is all in a lifetime! Show me first somebody who has never… and t

ural 1269. Obscene Words Filter

1269. Obscene Words Filter Time limit: 0.5 secondMemory limit: 8 MB There is a problem to check messages of web-board visitors for the obscene words. Your elder colleagues commit this problem to you. You are to write a program, which check if there i