1767 - I2P(I)2019_Yang_EECS_hw4 Scoreboard

Time

2019/10/01 21:00:00 2019/10/08 18:00:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
11593 Mexican Wave
11605 Polynomial Calculator
12393 Ugly Number

11593 - Mexican Wave   

Description

James, a pro photographer, recently went to a baseball game. He was very interested in Mexican wave, so he decided to take some photos of it.

Image that there are n spectators in the stadium, labelled from 1 to n. The maximum length of the wave is m. The spectators start the Mexican wave at time 0.

 

- At time 1, the first spectator stands.
- At time 2, the second spectator stands.
- ...
- At time m, the m-th spectator stands.
- At time m + 1, the (m + 1)-th spectator stands and the first spectator sits.
- At time m + 2, the (m + 2)-th spectator stands and the second spectator sits.
- ...
- At time n, the n-th spectator stands and the (n - m)-th spectator sits.
- At time n + 1, the (n + 1 - m)-th spectator sits.
- ...
- At time n + m, the n-th spectator sits.

 

Now, James prints out T pictures he took and wants to play a game with you. For each picture, James will give you n, m, and the time t he took the picture. Can you predict how will picture looks like?

If you win the game, maybe James will teach you some tips about shooting an astonishing picture.

Input


The first line contains one integer number T, representing the numbers of photos.

The next T lines contain three integers n, m, t, representing the number of spectators, the maximum length of the wave, and the time James took the picture.

1 <= T <= 100
1 <= m <= n <= 100
0 <= t <= 100

Output

For each picture please output a line contains n characters, representing the states of the n spectators. If a spectator is sitting, please print '-', otherwise please print '^'. You can find out more information in sample output.

Sample Input  Download

Sample Output  Download

Tags




Discuss




11605 - Polynomial Calculator   

Description

You are given a polynomial f(x). deg(f(x)) = N.
Given a integer M, please output the answer of f(M).

Sample Output Explanation : in sample input, the equation is x3 - x + 3, When M = 2, f(M) = 9

Input

The first line contains two integer numbers N, M, representing the degree of f(x) and the input number.
The second line contains N+1 integer numbers an, ... , a1a0, representing the coefficient of xn, xn-1, ... , x2, x1, x0.

  • 1 ≤ N ≤ 100
  • -1000 ≤ M, ai ≤ 1000
  • -109 ≤ f(M) ≤ 109

Output

Please output the answer of ​f(M)

Remember to print '\n' after your answer.

Sample Input  Download

Sample Output  Download

Tags




Discuss




12393 - Ugly Number   

Description

Let's define beauty of an array element x to be number of array elements which are multiples(倍數) of x - number of array elements which are divisors(因數) of x.

The ugliest element in an array is the one with the least beauty.

For example, given an array { 4, 8, 7, 14 } :

  • For the first element 4, it has 2 multiples (4, 8) and 1 divisor (4) in the array. Therefore its beauty is 2-1=1.

  • For the second element 8, it has 1 multiple (8) and 2 divisor (4, 8) in the array. Therefore its beauty is 1-2=-1.

  • For the third element 7, it has 2 multiples (7, 14) and 1 divisor (7) in the array. Therefore its beauty is 2-1=1.

  • For the fourth element 14, it has 1 multiple (14) and 2 divisors (7, 14) in the array. Therefore its beauty is 1-2=-1.

The second element 8 and the fourth element 14 has the least beauty, so 8 and 14 are the ugliest elements in the array, in which 8 is the smallest of all ugliest elements.

Given an array consist of integers, please output the smallest ugliest element.

Input

The first line of the input contains an integer n, begin the size of the given array. The second line of the input contains n integers, begin the given array.

  • 1 <= n <= 1000

  • 1 <= array elements <= 100000

Output

Output the ugliest element of the given array. Remember to add a '\n' in the end.

Sample Input  Download

Sample Output  Download

Tags




Discuss