Welcome to Yumao′s Blog.
ZOJ Problem Set – 2970 Faster, Higher, Stronger
, 2010年04月13日 , C Language , 评论 在〈ZOJ Problem Set – 2970 Faster, Higher, Stronger〉中留言功能已關閉 ,
Faster, Higher, Stronger
Time Limit: 1 Second      Memory Limit: 32768 KB

In the year 2008, the 29th Olympic Games will be held in Beijing. This will signify the prosperity of China and Beijing Olympics is to be a festival for people all over the world as well.

The motto of Olympic Games is “Citius, Altius, Fortius”, which means “Faster, Higher, Stronger”.

In this problem, there are some records in the Olympic Games. Your task is to find out which one is faster, which one is higher and which one is stronger.

Input

(閱讀全文…)

Zoj2966 Build The Electric System
, 2010年04月13日 , C Language , 评论 在〈Zoj2966 Build The Electric System〉中留言功能已關閉 ,
Build The Electric System
Time Limit: 1 Second      Memory Limit: 32768 KB

In last winter, there was a big snow storm in South China. The electric system was damaged seriously. Lots of power lines were broken and lots of villages lost contact with the main power grid. The government wants to reconstruct the electric system as soon as possible. So, as a professional programmer, you are asked to write a program to calculate the minimum cost to reconstruct the power lines to make sure there's at least one way between every two villages.

Input

ZOJ Problem Set – 1007 Numerical Summation of a Series
, 2010年04月10日 , C Language , 评论 在〈ZOJ Problem Set – 1007 Numerical Summation of a Series〉中留言功能已關閉 ,
Numerical Summation of a Series

——————————————————————————–

Time Limit: 10 Seconds      Memory Limit: 32768 KB      Special Judge

——————————————————————————–

Produce a table of the values of the series

Equation 1
for the 2001 values of x, x= 0.000, 0.001, 0.002, …, 2.000. All entries of the table must have an absolute error less than 0.5e-12 (12 digits of precision). This problem is based on a problem from Hamming (1962), when mainframes were very slow by today's microcomputer standards.

ZOJ Problem Set – 1006 Do the Untwist
, 2010年04月04日 , C Language , 评论 在〈ZOJ Problem Set – 1006 Do the Untwist〉中留言功能已關閉 ,
Do the Untwist

——————————————————————————–

Time Limit: 1 Second      Memory Limit: 32768 KB

——————————————————————————–

Cryptography deals with methods of secret communication that transform a message (the plaintext) into a disguised form (the ciphertext) so that no one seeing the ciphertext will be able to figure out the plaintext except the intended recipient. Transforming the plaintext to the ciphertext is encryption; transforming the ciphertext to the plaintext is decryption. Twisting is a simple encryption method that requires that the sender and recipient both agree on a secret key k, which is a positive integer.

The twisting method uses four arrays: plaintext and ciphertext are arrays of characters, and plaincode and ciphercode are arrays of integers. All arrays are of length n, where n is the length of the message to be encrypted. Arrays are origin zero, so the elements are numbered from 0 to n – 1. For this problem all messages will contain only lowercase letters, the period, and the underscore (representing a space).

(閱讀全文…)

关键字:, , , , , , ,
ZOJ Problem Set – 1005 Jugs
, 2010年04月04日 , C Language , 评论 在〈ZOJ Problem Set – 1005 Jugs〉中留言功能已關閉 ,
Jugs

——————————————————————————–

Time Limit: 1 Second      Memory Limit: 32768 KB      Special Judge

——————————————————————————–

In the movie “Die Hard 3”, Bruce Willis and Samuel L. Jackson were confronted with the following puzzle. They were given a 3-gallon jug and a 5-gallon jug and were asked to fill the 5-gallon jug with exactly 4 gallons. This problem generalizes that puzzle.

You have two jugs, A and B, and an infinite supply of water. There are three types of actions that you can use: (1) you can fill a jug, (2) you can empty a jug, and (3) you can pour from one jug to the other. Pouring from one jug to the other stops when the first jug is empty or the second jug is full, whichever comes first. For example, if A has 5 gallons and B has 6 gallons and a capacity of 8, then pouring from A to B leaves B full and 3 gallons in A.

A problem is given by a triple (Ca,Cb,N), where Ca and Cb are the capacities of the jugs A and B, respectively, and N is the goal. A solution is a sequence of steps that leaves exactly N gallons in jug B. The possible steps are

fill A
fill B
empty A
empty B
pour A B
pour B A
success

分页 (4): « 1 2 3 4 »