# | Problem | Pass Rate (passed user / total user) |
---|---|---|
12534 | I'm reference |
|
13163 | KYてぇてぇ — Birthday Present(class) |
|
13184 | Twenty One - It's free to come in |
|
13893 | Polynomial Calculator 2 |
|
13905 | Example Partial Problem |
|
13909 | I2P(II) 2023_Kuo_Midterm2_rule |
|
Description
Download the C++ reference.
You will see the file named "12534.cpp" but that's OK.
Just download the file and change the filename extension(副檔名) into "zip" then you can upzip the file and use the reference.
The link is below.
Input
Output
Sample Input Download
Sample Output Download
Partial Judge Code
12534.cppPartial Judge Header
12534.hTags
Discuss
Description
Kuo-chan is given a sequence A and a constant K as his birthday present from Yang-chan.
Kuo-chan is allowed to perfrom the following operation:
- push x — push x to the end of A
- pop — remove the median value of A (the median value of A is A[ (|A|+1)/2 ])
- programming tanoshi — for 1 <= i <= |A|, assign A[ i ] % K to A[ i ]
For example, if A = [4, 3, 5], K = 2
push 11 ► A = [4, 3, 5, 11]
pop ► A = [4, 5, 11]
pop ► A = [4, 11]
programming tanoshi ► A = [0, 1]
Yang-chan is curious about what A is after Kuo-chan performs some operations to it.
Help him find it out!
Input
The first line contains three integers N K Q — the length of A, the constant Yang-chan gives Kuo-chan, the number of operations Kuo-chan performs.
The second line contains N integers a1, a2, ..., aN (1 <= ai <= N) — the elements of A.
Each of the next Q lines describes the operations. Each line is one of three types:
- push x (1 <= x <= N)
- pop
- programming tanoshi
Different testcases have different constraints.
- N <= 103, Q <= N, K <= N, operations: {pop}
- N <= 103, Q <= 2N, K <= N, operations: {pop, push}
- N <= 103, Q <= 2N, K <= N, operations: {pop, push, programming tanoshi}
- N <= 105, Q <= N, K <= N, operations: {pop}
- N <= 105, Q <= 2N, K <= N, operations: {pop, push}
- N <= 105, Q <= 2N, K <= N, operations: {pop, push, programming tanoshi}
Output
You should print one line containing the elements of A after the operations. For 1 <= i <= |A|, the i-th number should be A[ i ].
Sample Input Download
Sample Output Download
Partial Judge Code
13163.cppPartial Judge Header
13163.hTags
Discuss
Description
After watching the movie 21, Kuo is curious about casino.
There is a casino which opens N days in this month.
There will be two kind of events in a day.
- Guest <Someone> <Money> <Skill>. It means <Someone> enter the casino with <Money> money. <Someone> are their names, <Money> is the amount of money with them, and <Skill> is how well they play. If <Someone> are already in the casino or are blacklisted, ignore this event.
- Win <Someone> <Money>. It means <Someone> win <Money> money in a play from the casino. <Money> may be positive or negative. If <Someone> are not in the casino or are blacklisted, ignore this event.
Whenever one become bankrupt, they will be kicked out of the casino and be blacklisted.
If the amout of money someone win in a play exceed (that is, >) twice of their <Skill>, they will be seen as cheaters, kicked out of the casino, and blacklisted. (The casino still has to pay the money they win to them.)
Someone blacklisted are not permitted to enter the casino.
Note: If someone have to pay X money but they only have Y money where Y <= X, they will only pay Y money and become bankrupt.
At the end of each day, everyone will leave the casino.
Please help Kuo-chan find how much income the casino gets in this month and who are blacklisted.
Input
The first line of the input contains a number N — the number of days in this month.
The following contains N blocks.
The first line of each block is Casino Q — it means there will be Q events this day.
The next Q lines is one of the following:
- Guest <Someone> <Money> <Skill>
- Win <Someone> <Money>
N <= 1000, Q <= 100.
There will be at most 1000 different people come to the casino; that is, there are at most 1000 people with different names. Therefore, there will be at most 1000 people blacklisted.
All number is within the range of int.
Output
You should print a number U in the first line — how much income the casino gets in this month.
If there are K people blacklisted in this month, you should output their names in K lines in the order they get blacklisted.
Sample Input Download
Sample Output Download
Partial Judge Code
13184.cppPartial Judge Header
13184.hTags
Discuss
Description
Most of the problem are as same as Polynomial Calculator (https://acm.cs.nthu.edu.tw/problem/13890/), the only difference is that you think if a calculator can only calculate f(x) is too weak, so you decide to add a function: differential.
There is one more function in class Function:
Function *differential(): this is used to return the differential function, and it needs all its derived class to override it.
Differential Formula:
Please paste the following code after the code you write, and don't forget to include "function.h"!
Function* Function::parse(stringstream &ss){
string s;
ss >> s;
if(s == "+" || s == "-" || s == "*" || s == "/"){
Function *a = parse(ss), *b = parse(ss);
Function *now = Arithmetic::create(a, s[0], b);
return now;
}else if(s[0] == 'x'){
Function *now = Variable::create(s);
return now;
}else if(s == "**"){
Function *a = parse(ss), *b = parse(ss);
Function *now = Polynomial::create(a, b);
return now;
}else if(s == "sin"){
Function *a = parse(ss);
Function *now = Sin::create(a);
return now;
}else if(s == "cos"){
Function *a = parse(ss);
Function *now = Cos::create(a);
return now;
}else{
Function *now = Constant::create(atoi(s.c_str()));
return now;
}
}
Input
The first line contains a preordered polynomial f(x):
- Constants and Variable: constant value or variable x, ex. x, 5.3, 7
- Polynomial operator: ** a b, represent ab, it's guarantee no x in b
- Arithmetic operator: op a b, represent a op b, ex. + 5 x means 5 + x. op constains only + - * /
- Trignomotric operator: op a, represent op(a), ex. sin x means sin(x). op contains only sin and cos
The second line contains an integer Q, means the number of queries.
The following Q lines are the queries, each line contains an integer x.
The length of the first line won't exceed 1e6, and 1 <= Q <= 2e5.
Each constant and query is between [-100, 100]. It's guarantee that no overflow and divided by 0
Output
For each x, please output the answer of f(x) and f'(x).
Sample Input Download
Sample Output Download
Partial Judge Code
13893.cppPartial Judge Header
13893.hTags
Discuss
Description
In this Problem, we are going to learn how to write partial judge problem.
We will use Code::Blocks to demonstrate
Create New Project
First, create a new project (go to File->New->Project)
Select Console Application and go
Select a language you should be using
Name the project, and select where to store it
Usually you do not need to change anything here, just click Finish
Now you have create a project
Import Files
Now we have to add files into the project, to let codeblocks know which files to compile
Choose Add files... in the Project tab
Add the files you downloaded from the Online Judge (remember to rename header file to function.h)
And OK
And you should see the files in their respective folders in the bar on the left hand side (main.cpp is the default file created when you created a project)
Write Code
Search for the functions you have to write (usually in function.h).
For example, in this problem, you will have to implement these 4 functions: setScore(int), setName(string), getScore(), getName()
IMPORTANT: Do not implement the functions in header, or copy the whole header to another file (you will see why later)
Instead, create a new cpp file, and write the implementation there. Remember to #include "function.h"
For example, writing a class function, the format should be [type] [class]::[function name]
After you finished, you can press build and run as usual, and it should work
Submit
To submit the code to Online Judge, just select all the code you wrote in the cpp files, and copy-paste it to the Submit section (no deleting or commenting needed)
Open a Project
To open a project that is already created, select File->Open...
Find the .cbp file, it should be at the place you chose when you were naming the project
Another way
1. copy the h file to the cpp file
2. write until the cpp can work
3. copy the upper part from the top until the original c++ part
4. Submit
Input
Given an integer, then a string
Output
Output a string, then an integer
Sample Input Download
Sample Output Download
Partial Judge Code
13905.cppPartial Judge Header
13905.hTags
Discuss
Description
-
Only C and C++ are allowed. Solving problems with other languages (e.g. python, java) are forbidden, otherwise you'll get zero point.
-
Paper references, electronic devices, or other items that may contain any information relative to this exam are not allowed.
-
Before leaving, please tell TAs, we'll check if your accepted / partially accepted submissions are all written in C or C++. After you pass the check, you may sign your name as a record and leave.
-
The score of each problem is shown below:
-
13163: 33.3
points
-
13184: 33.3
points
-
13893: 33.3
points
-
If you get partially correct in a problem, your score of the problem will be
-
score of the problem
*number of testcases you passed
/number of testcases
For example, if score of a problem is 10 points and the problem contains 6 testcases. If you pass the 3 testcases, you'll get 10*3/6=5
points on this problem.