2399 - I2P(I)2021_Yang_lab3 Scoreboard

Time

2021/10/19 18:30:00 2021/10/19 20:30:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
12384 One Digit Adding
13299 Rearrange 2

12384 - One Digit Adding   

Description

小磚頭(Small Brick) is a boy who love to do addition.

However, he never understand why 1+1 equals to 2 but not 11,

why is 3+33+333 equals to 369 but not 333333.

 

Until one day he saw a man programming in Python.

The man type: '3'+'33'+'333', magically, the answer is '333333'!

This breaking news astonished 小磚頭(Small Brick).

He run excitedly back to home, and told you the news.

However, you know that the answer is exactly not 333333.

Can you help 小磚頭(Small Brick) to find the correct answer?

 

Given a digit number A, and a number K.

We defined that S1=A, S2=AA, S3=AAA... .

Please calculate S1 + S2 + .. + SK.

 

For Example: A=3, K=3

then the answer is 3 + 33 + 333=369.

 

ouo.

 

Hint1: you can use long long type to store output

Hint2: you can use %lld to print long long type

Input

Input contain only one line.

2 number A, K with a space between.

It is guarantee A is a digit number and 1 <= K <= 16.

Output

Output the answer with a new line character at the end.

Sample Input  Download

Sample Output  Download

Tags




Discuss




13299 - Rearrange 2   

Description

There are N students in line according to the seat number, then M pairs of students exchanged their positions in the sequence.

Can you help the teacher find the positions of students K~ KQ

 

For example, N = 4 M = 3, and three exchanges are:

1 2

2 3

3 4

The seat arrangement of students during the exchange process:

1 2 3 4

-> 2 1 3 4

-> 2 3 1 4

-> 2 3 4 1

The final positions of students 1 ~ N are 4 1 2 3

Input

The first line contains three integers N M Q, the number of students, the number of pairs who exchange positions and the number of students whose positions the teacher wants to know.

Each of the next M lines contains two integers a b, indicating the seat exchange.

The last line contains Q integers that mean K~ KQ, giving the id. of the students whose positions the teacher wants to know.

 

 

test cases:

(4/6) 1 <= a, b, K<= N, M, Q <= 1000

(1/6) 1 <= a, b, Ki <= N, M <= 1000, 1 <= Q <= 1000000

(1/6) 1 <= a, b, Ki <= N, M <= 100000, 1 <= Q <= 1000000

NOTE:

To pass test cases 5 and 6, please consider how to reduce unnecessary loop iterations.

Output

The positions of students K~ KQ

Note that you need to print ‘\n’ at the end of the output.

Sample Input  Download

Sample Output  Download

Tags




Discuss