as3_statement
as3_statement
Requirements
Code (90%)
You can write your code in Java, Python, C, or C++. The time limit may vary among different
languages, depending on the performance of the language. Your code must be a complete excutable
program instead of only a function. We guarantee test data strictly compliance with the requirements
in the description, and you do not need to deal with cases where the input data is invalid.
Libraries in this assignment:
• For C/C++, you can only include standard library.
• For Java, you can only import java.util.*
• For Python, you can only import standard library. In other words, you cannot import libraries
such as numpy.
Report (10%)
You also need to write a report in pdf type to explain the following:
• What are the possible solutions for the problem?
• How do you solve this problem?
• Why is your solution better than others?
Please note that the maximum number of pages allowed for your report is 5 pages.
Remember that the report is to illustrate your thinking process. Keep in mind that your report is
supposed to show your ideas and thinking process. We expect clear and precise textual descriptions
in your report, and we do not recommend that you over-format your report.
Input
Two integers in one line: A, and B
Output
One integer: A + B
1
Solutions
Java
import java . util .*;
Python
AB = input (). split ()
A , B = int ( AB [0]) , int ( AB [1])
print ( A + B )
C
# include < stdio .h >
C++
# include < iostream >
C. Submission
After finishing this assignment, you are required to submit your code to the Online Judge System
(OJ), and upload your .zip package of your code files and report to BlackBoard.
2
Note: The program running time may vary on different machines. Please refer to the result of
the online judge system. OJ will show the time and memory limits for different languages on the
corresponding problem page.
If you have other questions about the online judge system, please refer to OJ wiki (campus network
only). If this cannot help you, feel free to contact us.
C.2 BlackBoard
You are required to upload your source codes and report to the BlackBoard platform. You need
to name your files according to the following rules and compress them into A1_<Student ID>.zip :
A1_ < Student ID >. zip
| - - A1_P1_ < Student ID >. java / py / c / cpp
| - - A1_P2_ < Student ID >. java / py / c / cpp
| - - A1_Report_ < Student ID >. pdf
For Java users, you don’t need to consider the consistency of class name and file name.
For example, suppose your ID is 123456789, and your problem 1 is written in Python, problem 2 is
written in Java then the following contents should be included in your submitted A1_123456789.zip:
A1_123456789 . zip
| - - A1 _P 1_ 1 23 45 67 8 9 . py
| - - A1 _P 2_ 1 23 45 67 8 9 . java
| - - A 1 _ R e p o r t _ 1 2 3 4 5 6 7 8 9 . pdf
FAQs
Q: I cannot access to Online Judge.
A: First, please ensure that you are using the campus network. If you are not on campus, please use
the university VPN. Second, please delete cookies and refresh browser or use other browser. If you
still cannot access to Online Judge, try to visit it via the IP address 10.26.200.13.
Q: My program passes samples on my computer, but not get AC on OJ.
A: Refer to OJ Wiki Q&A
Authors
If you have questions for the problems below, please contact:
• Problem 1. The 2023 Programming Contest of CUHK-Shenzhen (official)
• Problem 2. The 2023 Programming Contest of CUHK-Shenzhen (official)
• Problem 3. Yige Jiang: [email protected]
3
CSC3100 Data Structures Spring 2024
Programming Assignment 3
1.2 Input
The inputs consist of a single line that contains a string S of at most 20 letters. Each letter in S is
either of ‘A’, ‘B’ or ‘O’, where ‘A’ means Team A scores, ‘B’ means Team B scores, while ‘O’ means
no team scores in the 2023 PigCup final.
1.3 Output
Output the scores of Team A and Team B on the first two lines, respectively, with the format “A:X”
and “B:Y”, where X is the score of Team A and Y is the score of Team B.
On the third line, output the result of the game. If Team A wins, output “A wins!”. If Team B wins,
output “B wins!”. If the game results in a tie, output “Draw!”. The detailed output format can be
found in the example.
4
Figure 1: Enter Caption
2.2 Input
Each test contains multiple test cases. The first line contains a single integer T (1 ≤ T ≤ 30 000) —
the number of test cases. A description of the test cases follows.
The only line for each test case contains three integers in one line, r1 , r2 , d (1 ≤ d < r1 < r2 ≤ 1 000).
5
2.3 Output
For each testcase, output one real number in a line, representing the maximum thickness of the second
watermelon rind.
Your answer will be considered correct if its absolute or relative error does not exceed 10−4 .
3.2 Input
The first line contains an integer n.
The second line contains n numbers, where the i-th number represents the color of node i (1 for black,
0 for white).
The following n − 1 lines, each line contains three integers u, v, w, representing an edge connecting
node u and node v with a distance of w. Note that n, u, v, w > 0.
3.3 Output
Output n lines, the i-th line represents ansi .
6
You can find more samples in the attached file on BB.
3.5 Hint
For Python users, if there occurs a RecusrionError, see here.