# Blue Bridge Cup 2020 provincial competition (Group C of Java University)

Hang it first, and don't write the repeated questions

## #A index calculation

Total score of this question: 5 points

Problem description

July 1 is the party building day. From 1921 to 2020, the Communist Party of China has led the Chinese people
After 99 years.
Please calculate: 7 2020 7^{2020} 72020 mod 1921, where A mod B represents the remainder of A divided by B.

This is a result filling question. You just need to calculate the result and submit it. The result of this question is a
Integer. When submitting the answer, only fill in this integer. If you fill in the redundant content, you will not be able to score.

NULL

calcCode:

## #B decryption

Total score of this question: 5 points

Problem description

Xiao Ming designed a method of article encryption: for each letter c c c. Turn it into something else
character T c T_c Tc​. The following table shows the rules of character transformation:

For example, encrypt the string YeRi to obtain the string EaFn.
Xiao Ming has a random string, encrypted as
EaFnjISplhFviDhwFbEjRjfIBBkRyY
(it consists of 30 upper and lower case English letters, excluding line breaks). What is the original string?
(if you copy the above strings and tables into a text file, be sure to check the copied contents
Whether it is consistent with that in the document. There is a file str.txt in the test question directory. The first line is the characters above
String, followed by 52 rows of contents in the table.)

This is a result filling question. You just need to calculate the result and submit it. The result of this question is a
Contains only 30 30 A string of 30 upper and lower case English letters. When submitting the answer, only fill in this string and fill in
Extra content will not be scored.

YeRikGSunlRzgDlvRwYkXkrGWWhXaA

calcCode:

```import java.io.*;

public class Test {

public static void main(String[] args) throws IOException {
int[] str = new int[30], table = new int[128];
for (int i = 0; i < 30; i++)
str[i] = in.nextChar();
for (int i = 0; i < 52; i++) {
int v = in.nextChar(), w = in.nextChar();
table[w] = v;
}
StringBuilder out = new StringBuilder();
for (int i = 0; i < 30; i++)
out.appendCodePoint(table[str[i]]);
System.out.print(out);
}

InputStream in;
int next, len;
byte[] buff;

InputReader(InputStream in) { this(in, 8192); }

this.buff = new byte[buffSize];
this.next = this.len = 0;
this.in = in;
}

int getByte() {
if (next >= len)
try {
next = 0;
if (len == -1) return -1;
} catch (IOException e) { }
return buff[next++];
}

int nextChar() {
int c = getByte();
while (c <= 32 || c == 127) c =getByte();
return c;
}
}
}
```

Wrote an input stream
Type another watch and the result will come out

## #C running training

Total score of this question: 10 points

Problem description

Xiao Ming is going to do a running training.
At the beginning, Xiao Ming is full of physical strength, and the physical strength value is 10000. If Xiao Ming runs, he will lose every minute
600 physical strength. If Xiao Ming has a rest, he will increase his physical strength by 300 per minute. The loss and increase of physical strength are
Uniformly varying.
Xiao Ming plans to run for one minute, rest for one minute, run for another minute, rest for another minute... So
Ring. If Xiao Ming's physical strength reaches 0 at a certain time, he will stop exercising.
How long will Xiao Ming stop exercising. To make the answer an integer, output the answer in seconds.
Only fill in the number, not the unit in the answer.

This is a result filling question. You just need to calculate the result and submit it. The result of this question is a
Integer. When submitting the answer, only fill in this integer. If you fill in the redundant content, you will not be able to score.

NULL

calcCode:

## #D merge detection

Total score of this question: 10 points

Problem description

COVID-19 is caused by novel coronavirus, which has recently spread in country A. in order to control the epidemic as soon as possible, country a should
For a large number of people to enter the virus nucleic acid test.
However, kits for detection are in short supply.
In order to solve this difficulty, scientists have come up with a way: combined detection. About to from multiple people (k)
The collected samples are put into the same kit for testing. If the result is negative, it means this k
All of them were negative. The test of k individuals was completed with one kit. If the result is positive, it means
At least one person is positive, and all samples of this k person need to be tested independently again (theoretically,
If all K − 1 people are negative before the test, it can be inferred that the k-th person is positive, but in practice
Instead of using this inference, k individuals (independent detection) and the initial combined detection are used
k + 1 kits were used to complete the detection of k individuals.
Country A estimates that the infection rate of the tested people is about 1%, which is evenly distributed. How much can I get from k
Most economical kit?

This is a result filling question. You just need to calculate the result and submit it. The result of this question is a
Integer. When submitting the answer, only fill in this integer. If you fill in the redundant content, you will not be able to score.

10

calcCode:

```public class Main {

public static void main(String[] args) {
int MAX = 10000, min = 0x7ffffff, res = 0;
for (int i = 2; i <= MAX; i++) {
int cnt = MAX / i + MAX / 100 * i + (MAX % i == 0? 0: 1);
if (cnt < min) {
min = cnt;
res = i;
}
}
System.out.print(res);
}
}
```

Because no specific number of people was given, I didn't understand the questions for a long time

The enumeration is over

## #E REPEAT procedure

Total score of this question: 15 points

Problem description

Attachment prog Txt is a program written in a certain language.
Where REPEAT k represents a cycle with the number of times k. The range of loop control is expressed by indentation,
Starting from the next line, the contents contained in the loop are indented continuously more than the line (the front blank is longer).
For example, the following fragments:

```REPEAT 2:
A = A + 4
REPEAT 5:
REPEAT 6:
A = A + 5
A = A + 7
A = A + 8
A = A + 9
```

In this segment, the line from A = A + 4 to A = A + 8 is in the middle of the first line
Cycle twice.
The row from REPEAT 6: to A = A + 7 is in REPEAT 5: loop.
A = A + 5 the actual total number of cycles is 2 × five × 6 = 60 times.
What is the value of A after the program is executed?

This is a result filling question. You just need to calculate the result and submit it. The result of this question is a
Integer. Only fill in this integer when submitting the answer. If you fill in the extra content, you will not be able to score

NULL

calcCode:

## #F classification count

Time limit: 1.0s memory limit: 512.0MB total score of this question: 15 points

Problem description

Input a string, please output how many uppercase letters and how many small letters this string contains
Mother, how many numbers.

Input format

The input line contains a string.

Output format

Output three lines, one integer per line, representing the number of uppercase letters, lowercase letters and numbers respectively.

Test example 1

```Input:
1+a=Aab

Output:
1
3
1
```

Scale and agreement of evaluation cases

For all evaluation cases, the string consists of visible characters with a length of no more than 100.

code:

```import java.io.*;

public class Main {

public static void main(String[] args) throws IOException {
byte[] buff = new byte[100];
int len = System.in.read(buff), a = 0, b = 0, c = 0;
for (int i = 0; i < len; i++) {
if (buff[i] >= 'a' && buff[i] <= 'z') b++;
else if (buff[i] >= 'A' && buff[i] <= 'Z') a++;
else if (buff[i] >= '0' && buff[i] <= '9') c++;
}
System.out.print(a + "\n" + b + "\n" + c);
}
}
```

## #G divisible sequence

Time limit: 1.0s memory limit: 512.0MB total score of this question: 20 points

Problem description

There is a sequence. The first number of the sequence is n, and each subsequent number is the previous number divided by 2. Please enter
Find the items with positive values in this sequence.

Input format

The input line contains an integer n.

Output format

Output a line containing multiple integers. Adjacent integers are separated by a space to represent the answer.

Test example 1

```Input:
20

Output:
20 10 5 2 1
```

Test example 2

```Input:
987654

Output:
43636805
```

Scale and agreement of evaluation cases

For 80% of the evaluation cases, 1 ≤ n ≤ 109.
For all evaluation cases, 1 ≤ n ≤ 1018.

code:

## #H walk grid

Time limit: 1.0s memory limit: 512.0MB total score of this question: 20 points

Problem description

There are some two-dimensional lattice on the plane.
The numbers of these points are the same as those of a two-dimensional array, with lines 1 to n from top to bottom,
From left to right are columns 1 to m, and each point can be represented by row number and column number.
Now there is a man standing in row 1, column 1, going to row n, column m. Only right or down
Let's go.
Note that if the number of rows and columns are even, you cannot enter this field.
Ask how many options there are.

Input format

The input line contains two integers n, m.

Output format

Output an integer representing the answer.

Test example 1

```Input:
3 4

Output:
2
```

Test example 2

```Input:
6 6

Output:
0
```

Scale and agreement of evaluation cases

For all evaluation cases, 1 ≤ n ≤ 30, 1 ≤ m ≤ 30.

code:

## #I string encoding

Time limit: 1.0s memory limit: 512.0MB total score of this question: 25 points

Problem description

Xiao Ming invented a method to encode a string composed of all uppercase letters. For every big
Write A letter, Xiao Ming converts it into its serial number in 26 English letters, that is, A → 1, B → 2,... Z →
26.
In this way, a string can be converted into a sequence of numbers:
For example, ABCXYZ → 123242526.
Now, given a converted number sequence, Xiao Ming wants to restore the original string. Of course
There may be multiple strings that match the criteria for the restore of. Xiao Ming hopes to find the word with the largest dictionary order
Character string.

Input format

A sequence of numbers

Output format

A string containing only uppercase letters, representing the answer

Test example 1

```Input:
123242526

Output:
LCXYZ
```

Scale and agreement of evaluation cases

For 20% of the evaluation cases, the input length shall not exceed 20.
For all evaluation cases, the input length shall not exceed 200000.

code:

```import java.io.*;

public class Main {

static byte[] chars = { 0, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90 };

public static void main(String[] args) throws IOException {
PrintWriter out = new PrintWriter(System.out);
int flag = 0;
if (line.charAt(line.length() - 1) == '0') flag = 2;
int pre = 0;
for (int i = 0, h = line.length() - flag; i < h; i++) {
pre = pre * 10 + (line.charAt(i) & 0xf);
if (pre < 10) continue;
if (pre > 26) {
out.write(chars[pre / 10]);
pre %= 10;
} else if (pre > 10) {
out.write(chars[pre]);
pre = 0;
}
}
if (pre != 0) out.write(chars[pre]);
if (flag > 0) out.write(chars[(line.charAt(line.length() - 2) - '0') * 10]);
out.close();
}
}
```

One is to judge whether the output is complete, and the other is to judge whether the end can form a letter alone

## #J integer small splicing

Time limit: 1.0s memory limit: 512.0MB total score of this question: 25 points

Problem description

Define a length of n n Array of n A 1 , A 2 , ⋅ ⋅ ⋅ , A n A_1, A_2, · · · , A_n A1​,A2​,⋅⋅⋅,An​. You can choose two numbers from them A i A_i Ai and A j A_j Aj​
( i i i is not equal to j j j) , and then A i A_i Ai and A j A_j Aj ， spell a new integer from front to back. For example, 12 and 345 can
To spell 12345 or 34512. Attention exchange A i A_i Ai and A j A_j The order of Aj is always considered as two spellings, even if
yes A i A_i Ai​ = A j A_j Aj.
Please calculate how many spellings satisfy that the spelled integer is less than or equal to K K K.

Input format

The first line contains 2 2 2 integers n n n and K K K.
The second line contains n n n integers A 1 , A 2 , ⋅ ⋅ ⋅ , A n A_1, A_2, · · · , A_n A1​,A2​,⋅⋅⋅,An​.

Output format

Test example 1

```Input:
4 33
1 2 3 4

Output:
8
```

Scale and agreement of evaluation cases

For 30% evaluation cases, 1 ≤ N N N ≤ 1000, 1 ≤ K ≤ 1 0 8 10^8 108, 1 ≤ Ai ≤ 1 0 4 10^4 104.
For all evaluation cases, 1 ≤ N N N ≤ 100000，1 ≤ K K K ≤ 1 0 10 10^{10} 1010，1 ≤ \$A_i \$ ≤ 1 0 9 10^9 109.

code:

Tags: Java

Posted by contex on Wed, 11 May 2022 11:25:18 +0300