3228 - EE2310 Quiz 3 Scoreboard

Time

2025/09/22 11:00:00 2025/09/22 12:05:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
14706 Digit rotation
14715 Prime factorization
14716 Odd and even separation

14706 - Digit rotation   

Description

Write a program that repeatedly transforms a given integer as follows:

  • Take the last digit of the number and move it to the front.

  • If the last digit is 0, it becomes the first digit but is discarded.

For example:

  • 1234 → 4123

  • 1230 → 123

  • 1100100 → 110010 → 11001 → 11100 → 1110 → 111

The input contains two integers:

  • the initial number,

  • the number of times to perform the transformation.

Output the sequence starting from the original number, printing each intermediate result after every transformation.

(Hint

  • You may need to use a for-loop to repeat the process.

  • You may need to use / and % to separate the last digit and the remaining digits.

)

Input

Two integers: the number and the number of transformations.

Output

Print the number after each transformation step, starting with the original number.

Ensure that the output, including formatting, exactly matches the provided samples.

Sample Input  Download

Sample Output  Download

Tags

11410EE 231002



Discuss




14715 - Prime factorization   

Description

This program reads a positive integer n and performs prime factorization.
For each prime factor, output the prime number followed by its exponent.
The prime factors must be listed in ascending order.

Hint:

  • Start dividing n by the smallest prime (2).

  • Count how many times it can be divided (that is the exponent).

  • Continue with the next prime number (3, 5, 7, …) until n becomes 1.

 

Input

A single positive integer n.

Output

A sequence of integers, where each pair consists of a prime factor and its exponent, separated by a space.
Factors are listed from smallest to largest.

 

Take sample input 1 as example,

123456 = 26 x 31x 6431,

then, output

2 6 3 1 643 1 

Important Notes

  • A newline (\n) is printed at the end of the output.

  • A space must follow the last exponent before the newline.

  • The formatting of the output must match the samples exactly.

For example, 

// Sample Output 1
2 6 3 1 643 1' ''\n'    // ' ' is a blank space, and '\n' is a newline character

 

Sample Input  Download

Sample Output  Download

Tags

11410EE 231002



Discuss




14716 - Odd and even separation   

Description

This program reads an integer n, followed by a sequence of n integers.
The task is to separate the numbers into odd and even numbers.

Output two lines:

  • The first line contains all odd numbers in the sequence, separated by spaces.

  • The second line contains all even numbers in the sequence, separated by spaces.

Input

  • The first line contains one integer n, where 0<n≤100.

  • The second line contains n integers.

Output

Two lines:

  • Line 1: all odd numbers separated by spaces. A space must also follow the last number, before the newline.

  • Line 2: all even numbers separated by spaces. A space must also follow the last number, before the newline.

Ensure that the output, including formatting, exactly matches the provided samples.

Sample Input  Download

Sample Output  Download

Tags

11410EE 231002



Discuss