2211 - I2P(I)2020_Hu_hw9 Scoreboard

Time

2020/12/14 23:00:00 2020/12/21 18:30:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
12524 I,THIEF-test
13055 Fraction Structure
13056 Queen of banana milk kingdom

12524 - I,THIEF-test   

Description

You are a thief who try hard to steal money as much as possible along the street.  However, it's too dangerous to steal two adjacent houses. You should avoid this situation.  
Output the houses you stole in ascending order where the above two requirements are met.    


HINT: If you get TLE, you can try to store the answer of subproblem. Then next time you want the answer of some subproblem you've calculated before, you don't need to recalculate it.

Input

N

S_i

 

N is the number of house. 0<N<=100

S_i is representing the amount of money of each house, money amount is no more than 10000

Output

S

 

S are the houses you stole. 

Print the house you stole in ascending order.
You should print an additional space at the end of the line, and don't print the newline character at the end of the line.

Sample Input  Download

Sample Output  Download

Tags




Discuss




13055 - Fraction Structure   

Description

This is a partial judge problem.
In this problem, you're asked to implement the following function that related to fraction arithmetic.

typedef struct {
	long long numerator; 
	long long denominator; 
} Fraction;

First you have a struct binded with two integers which is the numerator and denominator of a fractrion.

Fraction CreateFrac(long long, long long);

Return a Fraction that its numerator is the first parameter and its demoniator is the second parameter.

void Reduction(Fraction*);

Reduce the fraction.

int Compare(Fraction, Fraction);

Compare two Fraction, if the first one is greater than the second one, return 1, otherwise return 0.

Fraction Add(Fraction, Fraction);
Fraction Sub(Fraction, Fraction);
Fraction Mul(Fraction, Fraction);
Fraction Div(Fraction, Fraction);

For the above four function, you have to return the irreducible fraction that is the result of doing the corresponding calculation.
Add stands for addition, Sub stands for subtraction, mul stands for Multiplication, Div stands for Division.
For the source code of main.c and function.h you can refer to the attachment below.
You're highly recommended to create an additional file function.c and compile it with the main source code instead of putting everything in one file.

 

Input

First line of the input contains one integer T (T <= 100000), representing the number of operation.
Next, input T lines. Each line contains one integer and two fraction.
The integer indicates which function to use.
Guarentee the numerator and denominator of the input fraciton is in the range of [1, 1000000] and the result fraction for each operation is positive non zero fraction.
For detail input format, you can refer to the source code.

Output

Output the calculation result for each operation.

Sample Input  Download

Sample Output  Download

Partial Judge Code

13055.c

Partial Judge Header

13055.h

Tags




Discuss




13056 - Queen of banana milk kingdom   

Description

Yazmonkey is the King of the banana milk kingdom. He got everything he wants except a wife. So he host a wife-chosen ceremony, he wants to choose the richest monkey among all candidates, which means he will choose the monkey who possesses the most banana milk.
You're asked to help Yazmonkey to complete the code in order to successfully select the best choice. What you have to implement is as follow.

typedef struct {
	int num; 
	char* name; 
} Monkey;

First you have a structure of monkey, num represents the amount of banana milk it possess.

Monkey* CreateMonkeyArray(int);

You should return a pointer points to the Monkey array with length equal to the parameter.

void SetVal(Monkey*, int, int, char[]);

Set the value of the index of second parameter of the Monkey array as the last two parameter.

int Compare(Monkey*, int, int);

Return 1 if the index of third parameter of the Monkey array have a higher priority than the index of second parameter of the Monkey array.

void Swap(Monkey*, int, int);

 Swap the value in the Monkey array.

void FreeMonkeyArray(Monkey*, int);

Free the Monkey array with length equal to the parameter. 
If you think the above description is not clear, you should trace the sorce code for detailed.
You're highly recommended to create an additional file function.c and compile it with the main source code instead of putting everything in one file.

Input

First line of the input contains one integer N, (N <= 1000), representing the number of candidates.
Next, Input contains N lines. In i-th line, it contains one integer Ki, (1 <= Ki <= 1000) and one string S, (|S| <= 50) which reprecenting the number of cartons of banana milks the i-th candidate has and the name of the monkey.
Guarentee that there's no two monkey has the same name.

Output

Output the order of the candidates sorted by the number of banana milk in decending order. If two candidates have the same amount of the banana milk, them sort it by the contray of lexicographic order.

Sample Input  Download

Sample Output  Download

Partial Judge Code

13056.c

Partial Judge Header

13056.h

Tags




Discuss