3198 - I2P(II)2025_Kuo_mid2 Scoreboard

Time

2025/05/06 15:30:00 2025/05/06 23:59:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
13172 Powers
14316 Template Function
14619 Naming Convention 2

13172 - Powers   

Description

This is a partial judge problem.

In this problem, you have to implement some power function in class special_power:

  • special_power(int n)  default constructor
  • int fpow(int x)  return xn % 880301
  • int fpow(int x, int m)  return xn % m
  • int fpow()  return 2n % 880301
  • string fpow(string s)  return sn
  • string fpow(string s, int m)  return sn % m

Note that n is a member in class special_power.

The definition of sn

Repeat the elements of s n times, and connect them

For example:

  • abcd4 = aaaabbbbccccdddd
  • csst3 = cccssssssttt

The definition of sn % m:

Repeat the elements of s n times, and connect them.

If the length of sn is longer than m, ignore the remaining elements.

For example:

  • abcd4 % 10 = aaaabbbbcc
  • csst3 % 4 = cccs

Input

The input has only one line, contains three integer x, n, m and one string s.

For all testcase:

  • 1 <= x, m <= 109
  • 1 <= n <= 106
  • 1 <= |s| <= 1000
  • (1/6) 1 <= xn, 2n < m <= 880301, 1 <= |s| * n <= m
  • (1/6) 1 <= xn, 2n < m <= 880301
  • (1/6) 1 <= |s| * n <= m

Output

The output has five lines.

The 1st line, output the result of xn % 880301

The 2nd line, output the result of xn % m

The 3rd line, output the result of 2n % 880301

The 4th line, output the result of sn

The 5th line, output the result of sn % m

Sample Input  Download

Sample Output  Download

Partial Judge Code

13172.cpp

Partial Judge Header

13172.h

Tags




Discuss




14316 - Template Function   

Description

In this problem, you are required to implement four template functions: Reverse, Minimum, Maximum, and Average.

  1. template <typename T> void Reverse(T *const base, size_t n); function takes a pointer to the first element of an array and the size of the array. It reverses the array in place.
  2. template <typename T> T Minimum(T const *const base, size_t n); function takes a pointer to the first element of an array and the size of the array. It returns the minimum element(with respect to the < operator) in the array.
  3. template <typename T> T Maximum(T const *const base, size_t n); function takes a pointer to the first element of an array and the size of the array. It returns the maximum element(with respect to the < operator) in the array.
  4. template <typename T> T Average(T const *const base, size_t n); function takes a pointer to the first element of an array and the size of the array. It returns the average of the elements in the array. If T is an integer/character/boolean type, round down the result. If T is a string type, return a string that contains one character, which is the sum of all the characters in all strings, divided by the sum of string length.

Note: You shouldn't modify the original array in the Minimum, Maximum, and Average functions.

These lines of code might come in handy...

template void Reverse<char>(char *const, size_t);
template char Maximum<char>(char const *const, size_t);
template char Minimum<char>(char const *const, size_t);
template char Average<char>(char const *const, size_t);

Input

  • This is a partial problem. Input and output are handled by main.

The first line contains an integer n \((1 \le n \le 5 \times 10^4)\), the size of each array.

The second line contains n integers, the elements of the array \(a\) (\(-10^9 \le a_i \le 10^9\)).

The third line contains n integers, the elements of the array \(b\) (\(0 \le b_i \le 1\)).

The fourth line contains n characters, the elements of the array \(c\) (\(c_i\) is a lowercase letter).

The fifth line contains n strings, the elements of the array \(d\) (\(1 \le |d_i| \le 10^5\)).

\(n\)
\(a_1 \quad a_2 \quad \cdots \quad a_n\)
\(b_1 \quad b_2 \quad \cdots \quad b_n\)
\(c_1 \quad c_2 \quad \cdots \quad c_n\)
\(d_1 \quad d_2 \quad \cdots \quad d_n\)

Constraints

  • \(1 \le n \le 5 \times 10^4\)
  • \(-10^9 \le a_i \le 10^9\)
  • \(0 \le b_i \le 1\)
  • \(c_i\) is a lowercase letter
  • \(1 \le |d_i| \le 10^5\)
  • The sum of \(|d_i|\) is at most \(10^5\)

Output

  • This is a partial problem. Input and output are handled by main.

Sample Input  Download

Sample Output  Download

Partial Judge Code

14316.cpp

Partial Judge Header

14316.h

Tags




Discuss




14619 - Naming Convention 2   

Description

In computer programming, naming conventions improve the readability of code by providing consistent rules for naming identifiers. This problem focuses on converting variable names from kebab-case to either camel-case or snake-case, depending on a given instruction.

  • Kebab-case: Words are separated by hyphens (-).
    Example: an-example-of-variable-name.

  • Camel-case: The first letter of each word is capitalized and no separators are used.
    For instance, the kebab-case an-example-of-variable-name becomes AnExampleOfVariableName.

  • Snake-case: Words are joined using underscores (_).
    For instance, the kebab-case an-example-of-variable-name becomes an_example_of_variable_name.

You are given a list of variables in kebab-case along with the creation time $t_i$ and a flag $o_i$ indicating the target naming convention:

  • $o_i = 0$ for converting to camel-case.
  • $o_i = 1$ for converting to snake-case.

Your tasks are:

  1. Implement the constructors of the CamelCase and SnakeCase classes so that they convert the given kebab-case variable name into the corresponding naming convention.
  2. Implement the destructors for the base class Case and its derived classes, CamelCase and SnakeCase. When a variable is deleted, the destructor should print:
    • For a camel-case instance:
      Camel-case variable <VarName> created at time <CreateTime> is deleted
    • For a snake-case instance:
      Snake-case variable <VarName> created at time <CreateTime> is deleted

Here <VarName> is the converted variable name and <CreateTime> is the time when the variable was created.

Input

The first line contains an integer $N$, representing the total number of variables.

Each of the following $N$ lines contains:

  • A string $S_i$, the variable name in kebab-case, containing only hypthens and lowercase letters.
  • An integer $t_i$, the time when the variable is created.
  • An integer $o_i$, which indicates the target naming convention (0 for camel-case, 1 for snake-case).

Constraints

  • $1 \leq N \leq 12$
  • $S_i$ is a valid kebab-case variable name.
  • $1 \leq |S_i| \leq 100$
  • $o_i \in {0, 1}$

Output

For each variable, when the object is deleted, output exactly one line:

  • If the variable has been converted to camel-case, output:
    Camel-case variable <VarName> created at time <CreateTime> is deleted
  • If the variable has been converted to snake-case, output:
    Snake-case variable <VarName> created at time <CreateTime> is deleted

Sample Input  Download

Sample Output  Download

Partial Judge Code

14619.cpp

Partial Judge Header

14619.h

Tags




Discuss