# | Problem | Pass Rate (passed user / total user) |
---|---|---|
13372 | Pointer Magic |
|
13743 | Grades |
|
13745 | Matrix tros |
|
13749 | Brokenotkeyboardot |
|
Description
After getting rejected by a girl, Morty realizes that he does not need a girlfriend, what he needs is to study programming. He already understands the basics of C programming but is struggling to understand pointers.
To help him understand better, Morty decides to practice making functions to change values of 2 malloced arrays. The functions he made are:
Swap, which takes in 2 characters and 2 integers and uses them for coordinates for the integers that needs to be swapped. (A B 1 2 means to swap the values of A[1] and B[2])
Switch, swaps all the values of array A and array B
Replace, which takes in 1 character and 2 integers, the first 2 are used for coordinates whereas the last integer is used for the new value.(A 1 100 means replace the value of A[1] to 100)
Stop, which stops the program and prints out the contents of both arrays.
Once Morty finishes this program suddenly the girl he rejected changed her mind, so in order to help you get a girlfriend/boyfriend, Morty wants you to make this program.
This is a partial judge program.
Input
integer M, the size of both arrays
M*2 number of integers which are the values of both arrays
A number of Commands:
Swap (2 characters and 2 integers)
Switch
Replace (1 character and 2 integers)
Stop (Stop the program and print the arrays)
Output
The contents of both arrays followed by a newline
Sample Input Download
Sample Output Download
Partial Judge Code
13372.cPartial Judge Header
13372.hTags
Discuss
Description
Bojack has a list of names from the programming class. He needs to sort the list from the best grades to the lowest in order to know the best and worst student in the class. Help the Bojack to sort the grades! Note that everyone has a unique name, so if they have the same grades, sort it from Z to A. (Not A to Z!)
This is a partial judge program.
Input
The first line consists of an integer n
For the next n line, each line consists of an integer m and string s, representing the grade and name of the student
1 < n,m < 1000
1 < s < 50
Output
The lists of students name in descending order.
Sample Input Download
Sample Output Download
Partial Judge Code
13743.cPartial Judge Header
13743.hTags
Discuss
Description
Noosik's friend Darwin has to submit an essay s quickly but his keyboard is broken. For some reason, everytime he hits enter, it will type a string z instead. Help Noosik create a program for Darwin to split the essay.
Implement split string function and malloc a 2D array to store the splitted string and return it. Don't forget to free the memory space that was previously allocated.
Hint: Be careful with the memory usage ! Dynamically allocate to avoid MLE
This is a partial judge program.
Input
The first line is a string s, that needs to be splitted.
The second line is a string z, that needs to be replaced.
20 < s < 500
1 < z < 10
Output
Output the strings splitted by z followed by '\n' at the end of each splitted string.