0%

Codeforces Round #228 (Div. 1)

题目链接:C. Fox and Card Game

Fox Ciel is playing a card game with her friend Fox Jiro. There are n piles of cards on the table. And there is a positive integer on each card.

The players take turns and Ciel takes the first turn. In Ciel’s turn she takes a card from the top of any non-empty pile, and in Jiro’s turn he takes a card from the bottom of any non-empty pile. Each player wants to maximize the total sum of the cards he took. The game ends when all piles become empty.

Suppose Ciel and Jiro play optimally, what is the score of the game?

阅读全文 »

题目链接:POJ 2254

Description

As a member of an ACM programming team you’ll soon find yourself always traveling around the world: Zürich, Philadelphia, San José, Atlanta,… from 1999 on the Contest Finals even will be on a different continent each year, so one day you might get to Japan or Australia.

At the contest site it would be interesting to know how many miles you are away from home. For this sake, your job is to write a program to compute the geographical distance between two given locations on the Earth’s surface.

We assume that the Earth is a perfect sphere with a radius of exactly 6378 km. The geographical distance between A and B is the length of the geodetic line segment connecting A and B.

The geodetic line segment between two points on a sphere is the shortest connecting curve lying entirely in the surface of the sphere.

The value of pi is approximately 3.141592653589793.

阅读全文 »

题目链接:HDU 1875

Problem Description

相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离不能小于10米,也不能大于1000米。当然,为了节省资金,只要求实现任意2个小岛之间有路通即可。其中桥的价格为 100元/米。

阅读全文 »

题目链接:POJ 1066

Description

Archeologists from the Antiquities and Curios Museum (ACM) have flown to Egypt to examine the great pyramid of Key-Ops. Using state-of-the-art technology they are able to determine that the lower floor of the pyramid is constructed from a series of straightline walls, which intersect to form numerous enclosed chambers.

Currently, no doors exist to allow access to any chamber. This state-of-the-art technology has also pinpointed the location of the treasure room. What these dedicated (and greedy) archeologists want to do is blast doors through the walls to get to the treasure room. However, to minimize the damage to the artwork in the intervening chambers (and stay under their government grant for dynamite) they want to blast through the minimum number of doors. For structural integrity purposes, doors should only be blasted at the midpoint of the wall of the room being entered. You are to write a program which determines this minimum number of doors.

An example is shown below:

阅读全文 »

题目链接:POJ 1789

Description

Advanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for vegetable delivery, other for furniture, or for bricks. The company has its own code describing each type of a truck. The code is simply a string of exactly seven lowercase letters (each letter on each position has a very special meaning but that is unimportant for this task). At the beginning of company’s history, just a single truck type was used but later other types were derived from it, then from the new types another types were derived, and so on.

Today, ACM is rich enough to pay historians to study its history. One thing historians tried to find out is so called derivation plan — i.e. how the truck types were derived. They defined the distance of truck types as the number of positions with different letters in truck type codes. They also assumed that each truck type was derived from exactly one other truck type (except for the first truck type which was not derived from any other type). The quality of a derivation plan was then defined as

$1/Σ_{(t_o,t_d)}d(t_o,t_d)$

where the sum goes over all pairs of types in the derivation plan such that $t_o$ is the original type and $t_d$ the type derived from it and d($t_o$,$t_d$) is the distance of the types.
Since historians failed, you are to write a program to help them. Given the codes of truck types, your program should find the highest possible quality of a derivation plan.

阅读全文 »

题目链接:POJ 1679

Description

Given a connected undirected graph, tell if its minimum spanning tree is unique.

Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A spanning tree of G is a subgraph of G, say T = (V’, E’), with the following properties:

  1. V’ = V.
  2. T is connected and acyclic.

Definition 2 (Minimum Spanning Tree): Consider an edge-weighted, connected, undirected graph G = (V, E). The minimum spanning tree T = (V, E’) of G is the spanning tree that has the smallest total cost. The total cost of T means the sum of the weights on all the edges in E’.

阅读全文 »

题目链接:LightOJ - 1030

Description

You are in a cave, a long cave! The cave can be represented by a $1 \times N$ grid. Each cell of the cave can contain any amount of gold.

Initially you are in position $1$. Now each turn you throw a perfect $6$ sided dice. If you get $X$ in the dice after throwing, you add $X$ to your position and collect all the gold from the new position. If your new position is outside the cave, then you keep throwing again until you get a suitable result. When you reach the $N^{th}$ position you stop your journey. Now you are given the information about the cave, you have to find out the expected number of gold you can collect using the given procedure.

阅读全文 »

题目链接:LightOJ - 1027

Description

You are in a maze; seeing $n$ doors in front of you in beginning. You can choose any door you like. The probability for choosing a door is equal for all doors.

If you choose the $i^{th}$ door, it can either take you back to the same position where you begun in $x_i$ minutes, or can take you out of the maze after $x_i$ minutes. If you come back to the same position, you can’t remember anything. So, every time you come to the beginning position, you have no past experience.

Now you want to find the expected time to get out of the maze.

阅读全文 »