| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 11711 | Dynamic 3D array |
|
| 12498 | Partial Judge Example |
|
| 14417 | Holo the wise wolf |
|
| 14888 | Let The Water Flow |
|
| 14893 | Cortisol Meter |
|
| 14899 | Footstep Energy |
|
Description
In this problem, you are asked to design two functions
1.
unsigned*** new_3d_array(unsigned n,unsigned m,unsigned k);
malloc an n*m*k 3D unsigned array, and then return its address. The main function will check the correctness of your array.
2.
void delete_3d_array(unsigned ***arr);
Free the memory space of your array that was previously allocated by using malloc. Be careful about the memory uage of your program allocated dynamically so as to avoid MLE.
The two functions have been declared in function.h, and you are asked to complete the function definitions in function.c.
Your program should construct the 3D array by using only three malloc function calls. Notice that malloc is a time-consuming operation.
Note: for OJ submission:
Step 1. Submit only your function.c into the submission block. (Please choose C compiler)
Step 2. Check the results and debug your program if necessary.
Input
Please refer to the main function.
The input only has one line, consisting of five positive integers t,n,m,k,r separated by space characters, where t is the number of tests, (n,m,k) represents the array size, and r is a parameter for testing.
Note that n*m*k<=10000000 and t*n*m*k<=60000000
Output
In order to test your array's correctness, we will use your array to do some computations and output the results.
Sample Input Download
Sample Output Download
Partial Judge Code
11711.cPartial Judge Header
11711.hTags
Discuss
Description
This is the partial judge example (another method for online judge), you are asked to design a function below:
int call_add(int a, int b);
(implement a function to add two pass value togeter)
Note: for OJ partial judge submission:
Step 1. Submit only your function.c into the submission block. (Please choose C compiler)
Step 2. Check the results and debug your program if necessary.
/* the content below is what you need to copy and submit to oj*/
int call_add(int a, int b){
return a + b;
}
More information about the different of partial judge and normal judge

Input
Please refer to the main function.
The input only one line, contain two number a and b (1 < a < 10, 1< b < 10)
Output
Output a + b.
Sample Input Download
Sample Output Download
Partial Judge Code
12498.cPartial Judge Header
12498.hTags
Discuss
Description
Lawrence and Holo were traveling merchants who went from town to town trading various goods in order to make a profit. However, Holo spent too much money on other things like clothes, shoes, oil, comb, and lots of apples! Hence, Lawrence was upset about this and told her to records all these expense. Holo can do the math without any difficulty, but she was too lazy to do it, so she ask for your help. Please design a program which can do simple addition like 2486+7414 or 1919810+114514.

Input
The first line contains a single string s, representing the mathematical expression with two numbers and an operator +.
The string only includes numbers from 0~9 and + operator which would only appears once.
The length of the string would not exceed 200 characters.
The digits of the two numbers would not exceed 100 characters, but it might be too big to store in long long.
Output
Output the answer of the mathematical expression.
Note that you do NOT need to print '\n' at the end of the output.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
You are given an N * M grid representing a terrain, where each cell contains an integer between 1 and 15 representing its height.
A water source is placed at the top-left corner (0, 0). Water can flow from a cell to any of its four adjacent neighbors (up, down, left, and right), but only if the neighbor's height is less than or equal to the current cell's height.
Your task is to calculate the total number of cells that will be covered by water (including water source).
Constraints
1 <= N, M <= 100
Input
-
The first line contains two integers N and M, representing the number of rows and columns.
-
The following N lines each contain M integers, representing the heights of the cells in the grid.
Output
Output a single integer with '\n': the total number of cells reachable by the water from the top-left corner.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
It is the start of the semester, Tachyon and her fellow classmates are preparing for the second lab in Introduction to Programming(II).
To measure how stressful she is during the first few weeks, Tachyon recorded a daily "stress fluctuation" value for N days:
- A positive integer indicates that her stress level went up
- A negative integer indicates that her stress level went down
Afterward, Tachyon wants to compute her cortisol level during selected periods of time. For each of Q queries, she chooses two day a and b (both days are included), and outputs the sum of stress fluctuations over the selected period.


Constraints
- 1 <= N <= 10000
- 1 <= Q <= 100
- 0 <= a <= b < N
- -100 <= Ai <= 100
Input
- The first line contains an integer N
- The second line contains N integers, representing the "stress fluctuation" that day
- The third line contains an integer Q
- The next Q lines each contain two integers a b, representing the selected period of days (both inclusive)
Output
- For each query, output a single line containing the sum of stress fluctuations from day a to day b (both inclusive)
- Output '\n' after every line
Sample Input Download
Sample Output Download
Tags
Discuss
Description
When walking down the street one day, you suddenly notice a banner that reads:
Japan is turning footsteps into electricity! Using piezoelectric tiles, every step you take generates a small amount of energy. Millions of steps together can power LED lights and displays in busy places like Shibuya Station. A brilliant way to create a sustainable and smart city turning m...
Inspired by this idea, engineers install rows of piezoelectric tiles along a walkway. Each tile records how many footsteps landed on it.
In this problem, you are asked to design three functions
-
int **create_walkway(int n, const int *len); -
void activate_walkway(int n, const int *len, int **tile); -
void delete_walkway(int n, int **tile);
The three functions have been declared in function.h, and you are asked to complete the function definitions in function.c.
There are n walkways.
The i-th walkway contains len[i] tiles.
The judge will first generate the initial footstep counts, then store them into your allocated structure, and finally call your processing function.
When the system is activated, each tile generates energy using the footsteps recorded on itself and the tiles immediately next to it on the same walkway.
For each tile j, its new value is the sum of its own original value and the original values of the tiles right next to it (j-1 and j+1), if those neighbors exist
All walkways must be processed independently, and every update must be computed from the original values before any modifications are applied.
Your task is not only to allocate and free memory correctly, but also to simulate this activation process.
Function 1
int **create_walkway(int n, const int *len);
Allocate memory for n walkways.
The returned result should satisfy:
-
tile[i]points to a valid writable integer array -
tile[i]has exactlylen[i]elements
Function 2
void activate_walkway(int n, const int *len, int **tile);
For each walkway, update every tile according to the activation rule described above.
All new values of one walkway must be computed from the walkway's original values before any tile in that walkway is overwritten.
Note: The return type of Function 2 is void (previously miswritten as long long).
Function 3
void delete_walkway(int n, int **tile);
Free the memory space of the array that was previously allocated dynamically.
Constraints
- 1 <= t <= 100
- 1 <= n <= 1000
- 1 <= q <= 10
- 1 <= len[i] < =100
- 1 <= Initial walkway value <= 100
Input
The first line contains an integer t, the number of test cases.
For each test case:
-
The first line contains two integers
nandq.-
nis the number of walkways. -
qis the number of times the activation process will be applied.
-
-
The second line contains
nintegers
len[0], len[1], ..., len[n-1], wherelen[i]is the number of tiles in thei-th walkway. -
The next
nlines describe the initial footstep counts of the tiles.
For eachifrom0ton-1, thei-th of these lines containslen[i]integers representing the initial values stored in the tiles of thei-th walkway.
The input is handled by the judge program. Do not read from standard input.
Output
For each test case, after every activation step:
-
Print
nlines. -
The
i-th line should containlen[i]integers representing the values of the tiles in thei-th walkway after the activation.
Values in the same line should be separated by a single space.