1757 - I2P(I)2019_Yang_EECS_hw3 Scoreboard

Time

2019/09/24 21:00:00 2019/10/01 18:00:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
10766 Shell Game
11127 Binary representation&sum
12380 Low Wage

10766 - Shell Game   

Description

In a shell game, balls with different numbers are hidden beneath identical containers, which are placed in a line. After the containers are shuffled, players need to guess the order of balls.

 

In this problem, there are five balls, numbered 0-4, and placed under five identical containers. The containers are placed in a straight line, and the initial positions of balls are from 0-4. The problem will then give k swaps of containers. Each swap is represented by a pair of integers, (a,b), meaning the container is position a is swapped with the container in position b. Your program needs to print the final ordering of balls.

 

For example, k=3, and three swaps are

0 4

2 3

1 2

 

Initially, the order of balls is: 0 1 2 3 4. After the swap (0,4), the order of balls becomes: 4 1 2 3 0; After the swap (2,3), the order of balls becomes: 4 1 3 2 0; and after the swap (1,2), the order of balls becomes:

4 3 1 2 0. So your program needs to print

4 3 1 2 0

Input

The first line of the input is an integer k (0 < k < 25), which specifies the number of swaps. In the next k lines, each line contains a pair of integers, specifying the two positions to be swapped.

Output

The order of balls after swaps. Note that you do not need to print ‘\n’ at the end of the output.

Sample Input  Download

Sample Output  Download

Tags

10401Contest



Discuss




11127 - Binary representation&sum   

Description

Problem Description

Given a positive integer N, transform it to its unsigned binary representation (e.g. 10 => 1010). Your program needs to output the binary representation of N+1 and the number of carries during the addition in binary representation.

 

For example, if the input is 11 (in decimal), your program needs to output 1100, because it is the binary representation of 11+1=12. Also your program needs to output 2, because during the binary addition of 11+1, there are two carries generated.

 

     1011 (11 in binary)

+   0001 (1 in binary)

---------------------------------

     1100 (12 in binary)

Input

The input consist of an integer N (0 <= N <= 1024)

Output

The binary representation of N+1 and the number of carries during the binary addition of N+1. Those two numbers are separated by a space. Note that you do not need to print ‘\n’ at the end of the output.

Sample Input  Download

Sample Output  Download

Tags




Discuss




12380 - Low Wage   

Description

John is a poor worker in a factory.
His hourly wage is only X TWD/hour.
He works from H1:M1:S1 to H2:M2:S2 everyday.
Because the factory is black-hearted, if the working time is A hours B minutes C seconds, the daily wage is only A*X TWD.
Your task is to calculate John's working time and daily wage.

Example:
The Hourly wage is 125 TWD/hour. John works from 8:00:00 to 20:30:00, then his working time is 12 hour 30 minutes 0 seconds, and daily wage is 1500 TWD.

Input

On the first line, a number X represents John's hourly wage.
On the second line, H1:M1:S1 ~ H2:M2:S2 represents the time John start/end working.

0 <= X <= 10000
0 <= H1, H2 <= 23
0 <= M1, M2, S1, S2 <= 59

It's guaranteed that H1:M1:S1 is earlier than H2:M2:S2

Output

Output John's working time and daily wage.
The first line: "Working Time: A Hour(s) B Minute(s) C Second(s)".
The second line: "Daily Wage: D TWD".
A, B, C, D should be replaced by four numbers.

Please refer to the sample input/output for the precise format, and there is a '\n' at the end of each line.

Sample Input  Download

Sample Output  Download

Tags




Discuss