| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 11417 | String Operation |
|
| 11420 | Implement a vector 1 |
|
| 11443 | 3DShape |
|
| 12753 | Go on mission |
|
Description
Given a set of strings, perform the operations according to the following commands, and output the final result of the given set of strings.
Commands:
s n m: Swap the nth string and the mth string.
i n m: Insert the mth string at the tail of the nth string.
si n m: Swap the specified strings first, and then insert.
is n m: Insert first, and then swap the two specified strings.
e: Exit.
Consider a set of strings:
ab
cd
ef
And a sequence of commands:
s 0 1
i 1 2
The result will be:
cd
abef
ef
You will be provided with main.cpp and function.h, and asked to implement function.cpp.
Input
The first line is an integer N indicating the number of input strings.
The following N lines each contains one input string.
Starting from the N+2th line will be a sequence of commands.
Output
Output the final result of the input strings.
Sample Input Download
Sample Output Download
Partial Judge Code
11417.cppPartial Judge Header
11417.hTags
Discuss
Description
Warning: You are not allowed to use:
1. any static variables
2. any variables which is not inside a function
3. malloc and free
The storage of the vector is handled automatically, being expanded and contracted as needed. Vectors usually occupy more space than static arrays, because more memory is allocated to handle future growth. This way a vector does not need to reallocate each time an element is inserted, but only when the additional memory is exhausted.
REQUIREMENTS:
Implement the push_back(), pop_back(), reserve() and destructor member functions of Vector classes.
Note:
If the value of size is equal to the value of capacity, and you need to change the value of capacity (reallocate memory) when you push_back a new element. The rule of increasing capacity is: new capacity = max(old capacity + 1, old capacity * 3).
The constructor of vector will not create an array (which means size and capacity is 0).
Input
here are five kinds of commands:
- pop_back: removes the last element
- push_back: adds an element to the end
- capacity: returns the number of elements that can be held in currently allocated storage
- size: returns the number of elements
- reserve: reserves storage (Increase the capacity of the container to a value that's equal to new capacity. If new capacity is greater than the current capacity, new storage is allocated, otherwise the method does nothing.)
Each commands is followed by a new line character ('\n').
Output
The output should consist of the current state of the vector.
Sample Input Download
Sample Output Download
Partial Judge Code
11420.cppPartial Judge Header
11420.hTags
Discuss
Description
Warning: You are not allowed to use malloc and free
Giving a bass-class Shape3D and 4 derived class : Sphere (球體), Cone (圓錐), Cuboid (長方體), Cube (立方體)
You need to calculate the volume of each shape.
PS:
V of Sphere: V = 4/3 π r3
V of Cone: V = 1/3 π r2 h

note : Remember to do some basic check, if the input is illegal (e.g. length < 0, pi < 0 .....) then the volume should be 0.
You don't need to consider the scenario like Cuboid -1 -2 3, volume would be 0 instead of 6.
Hint1: Be careful the type of volume is double. 4/3=1 (int), so it should be 4.0/3.0
Hint2: You only need to implement the constructors.
Hint3: Note that Cube inherited Cuboid not Shape3D.
Input
There are only 4 shapes in this problem :
- Sphere, following by its radius and pi. (e.g. Sphere 30 3.14)
- Cone, following by its radius of bottom plane, height and pi. (e.g. Cone 3 100 3.14)
- Cuboid, following by its length, width and height. (e.g. Cuboid 2 3 7)
- Cube, following by its length. (e.g. Cube 2)
Output
Ouput the total volume of all the shapes.
Sample Input Download
Sample Output Download
Partial Judge Code
11443.cppPartial Judge Header
11443.hTags
Discuss
Description
This is a partial judge problem.

In Taisho-era Japan, demons hunt for human during night time. Therefore, Kisatsutai (鬼殺隊) sents demon slayers to protect the villagers. Tanjiro, Zenitsu, Inosuke are demon slayers who train themselves in Chouyashiki (蝶屋敷). Whenever there is a mission, Kisatsutai sents the one with highest health condition among the three. If their health condition are the same, the order of going on a mission is Inosuke > Tanjiro > Zenitsu. Initially, three of them have the same health condition. After they finish a mission, their health condition may compromise and need to rest and train themselves in Chouyashiki.
Their health condition is represented with a very big integer (<= 101200). Also, their health condition may be negative (but it is still okay to go on a mission).
Given the number of mission and how much health condition will be compromised in each mission, output each person's health condition after they finish all missions.
This is a partial judge problem. Inside function.h, there is a BigInt class for storing very big integer and a solution function to calculate the answer. Please choose C++11 compiler when submitting.
Explanation of Sample IO
Initially, three of them have equal health condition 71227122712271227122, and there are three missions.
For the first mission, Inosuke will go because he has highest order when they have same condition. After the mission, his health condition becomes 71227122712271227122 - 123456789987654321 = 71103665922283572801.
For the second mission, Tanjiro and Zenitsu have higher health condition. Tanjiro will go because he has high order than Zenitsu when they have same health condition. After the mission, his health condition becomes 71227122712271227122 - 91879487948794879487 = -20652365236523652365.
For the third mission, Zenitsu will go because he has the highest health condition. After the mission, his health condition becomes 71227122712271227122 - 7122712200000000 = 71220000000071227122.
Input
The first line is an integer N, begin the number of mission.
The second line is an integer H, begin the initial health condition of the three.
After that, there are N lines. The i-th line is an integer ci, meaning that the health condition of the one going on the i-th mission will be compromised by ci.
It is guaranteed that :
-
N <= 2000
-
0 <= H, ci <= 101200
-
-101200 < health condition < 101200, which means the health condition won't overflow the
BigIntclass.
Output
Please output three integers, each in a line.
The first integer is Tanjiro's health condition, the second integer is Zenitsu's, and the third is Inosuke's.
Note that there should not be trailing zeros or sign. For example, if the health condition is 87, you shouldn't print something like 00...0087; if the health is 0, you should print 0 instead of -0.