| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 11425 | Carry In |
|
| 11434 | Count the Value |
|
| 11435 | Stable Sort |
|
| 11436 | Is it a forest? |
|
| 11441 | Postfix Evaluation |
|
Description
Compute how many carries will occur when calculating the sum of two decimal numbers A and B.
Input
For each case a line, there are two positive integers A and B. There are multiple cases (<1000) terminated by EOF.
Case #1: 0<A, B<1000
Case #2: 0<A, B<106
Case #3: 0<A, B<1012
Case #4: 0<A, B<101000
Output
For each case a line, output how many carries occur.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Given an article, calculate the value of each character and output them in the descending order of their values. The price of characters is calculated as follows: one dollar for a letter ‘a’, two dollars for a letter ‘b’ … and 26 dollars for a letter ‘z’. 'A' and 'a' are not the same in this problem, just count the lowercase letters.
The input length (do not contain '\n' character) is smller than 65536.
Input
The input contains an article, which is terminated by EOF.
Output
Output the total value of each character in the descending order. Do not print the character not in the article. If two characters have the same value, output the one with smaller ASCII code first.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Given the grades of N people.
Please output the sorted result. (Increasing order)
If more people’s grades are same, output by input order.
Input
The input includes multiple test cases.
In each test case, the first line contains one integer N. The following N lines specify the name Si and the grade Gi.
1 <= N <= 105
1 <= |Si| <= 10
0 <= Gi <= 100 (Gi is an integer.)
Output
For every test case, output the result in N lines. Every line contains the name and the grade.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
An undirected graph is a forest if it contains no cycle.
Given an undirected graph, output "Yes" if it is a forest, otherwise "No".
Input
The input contains at most 20 test cases. For each test case, the first line contains two positive integers N (2 <= N <= 500000) and M (0 <= M <= 500000) separated by a space; N is the number of vertices and M is the number of edges in the undirected graph G. The vertices in G are denoted by v1, v2, ..., vN. (1 <=vi <= N) In the next M lines, each line contains two integers i and j separated by a space, which means that there is an edge between vi and vj.
There is a blank line after each test case. The last test case is followed by two zeros in one line.
Output
For each test case, output "Yes" if it's a forest, otherwise "No".
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Evaluate the result of a given numerical expression written in postfix notation.
Input
The first line of input contains an integer N (N ≤ 100) which denotes the number of test cases. Each test case begins with an integer M (M ≤ 10000) representing the number of tokens in the expression, followed by M tokens in the next line. Tokens are separated by spaces, and there are two types of tokens: operators and operands. Operators will only be “+”, “-”, “*” , or “/”; operands are integers in the range [0, 100]. The division operator “/” here is considered as integer division. You may assume that all of the expressions are valid (division-by-zero would never occur) and the evaluated results (in each stage of evaluation) will fit in 32-bit signed integer.
Output
For each test case, please output a line begins with the test case number “Case i:”, and then a space character followed by the evaluated answer.