Eva is trying to make her own color stripe out of a given one. She would like to keep only her favorite colors in her favorite order by cutting off those unwanted pieces and sewing the remaining parts together to form her favorite color stripe. It is said that a normal human eye can distinguish abou
Read more »

The task is really simple: given N exits on a highway which forms a simple cycle, you are supposed to tell the shortest distance between any pair of exits. Input Specification: Each input file contains one test case. For each case, the first line contains an integer N (in [3, 105]), followed by N
Read more »

Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with followers relations. When a user makes a post on Weibo, all his/her followers can view and forward his/her post, which can then
Read more »

A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: * The left subtree of a node contains only nodes with keys less than or equal to the node’s key. * The right subtree of a node contains only nodes with keys greater than the node’s key. * Both
Read more »

A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: * The left subtree of a node contains only nodes with keys less than or equal to the node’s key. * The right subtree of a node contains only nodes with keys greater than the node’s key. * Both
Read more »

This time your job is to fill a sequence of N positive integers into a spiral matrix in non-increasing order. A spiral matrixis filled in from the first element at the upper-left corner, then move in a clockwise spiral. The matrix has m rows and ncolumns, where m and n satisfy the following: m*n mus
Read more »

The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the speaker’s personality. Such a preference is called “Kuchiguse” and is often exaggerated artistically in Anime and Manga. For example, the artificial se
Read more »

It is said that in 2013, there were about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Province. It would help a lot if you could write a program to automate the admission procedure. Each applicant will have to provide two grades: the national entrance exam grade GE, an
Read more »

Given a sequence of positive integers and another positive integer p. The sequence is said to be a “perfect sequence” if M <= m * p where M and m are the maximum and minimum numbers in the sequence, respectively. Now given a sequence and a parameter p, you are supposed to find from the sequence as m
Read more »

是一偏序集合,B是A的子集。 (1) 元素b∈B是B的最大元素,如果对每一元素x∈B,x≤b (2) 元素b∈B是B的最小元素,如果对每一元素x∈B,b≤x (3)如果b∈B,且B中不存在元素x,使b≠x且b≤x,那么元素b∈B叫作B的极大元素 (4)如果b∈B,且B中不存在元素x,使b≠x且x≤b,那么元素b∈B叫作B的极小元素 (5)如果对每一b∈B,b≤a,那么a属于A叫做B的上界;如果对每一b∈B,a≤b,那么元素a属于A叫作B的下界 上面的≤特指的时偏序关系而不是≤这个比较运算符
Read more »
0%