首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
C/C++编程代做、代写Java,Python程序
项目预算:
开发周期:
发布时间:
要求地区:
A. 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.
We provide an example problem to illustrate the information above better.
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.
B. Example Problem: A + B Problem
Description
Given 2 integers A and B, compute and print A + B
Input
Two integers in one line: A, and B
Output
One integer: A + B
Sample Input 1
1 2
Sample Output 1
3
Problem Scale & Subtasks
For 100% of the test cases, 0 ≤ A, B ≤ 106
1
Solutions
Java
import java . util .*;
public class Example {
public static void main ( String [] args ) {
int a , b;
Scanner scanner = new Scanner ( System . in );
a = scanner . nextInt ();
b = scanner . nextInt ();
scanner . close ();
System . out . println (a + b );
}
}
Python
AB = input (). split ()
A , B = int ( AB [0]) , int ( AB [1])
print (A + B )
C
# include < stdio .h >
int main ( int argc , char * argv [])
{
int A , B ;
scanf ("%d%d", &A , &B );
printf ("%d\n", A + B );
return 0;
}
C++
# include < iostream >
int main ( int argc , char * argv [])
{
int A , B ;
std :: cin >> A >> B;
std :: cout < < A + B << std :: endl ;
return 0;
}
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.
C.1 Online Judge
Once you have completed one problem, you can submit your code on the page on the Online Judge
platform (oj.cuhk.edu.cn, campus only) to gain marks for the code part. You can submit your
solution of one problem for no more than 80 times.
After you have submitted your program, OJ will test your program on all test cases and give you a
grade. The grade of your latest submission will be regarded as the final grade of the corresponding
problem. Each problem is tested on multiple test cases of different difficulty. You will get a part of
the score even if your algorithm is not the best.
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_
.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_P1_123456789 . py
|-- A1_P2_123456789 . java
|-- A1_Report_123456789 . pdf
C.3 Late Submissions
Submissions after Feb 7 2024 23:59:00(UTC+8) would be considered as LATE.
The LATE submission page will open after deadline on OJ.
Submisson time = max{latest submisson time for every problem, BlackBoard submisson time}
There will be penalties for late submission:
• 0–24 hours after deadline: final score = your score×0.8
• 24–72 hours after deadline: final score = your score×0.5
• 72+ hours after deadline: final score = your score×0
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. Yingli Zhou: yinglizhou@link.cuhk.edu.cn Yuyang Xia: yuyangxia@link.cuhk.edu.cn
• Problem 2. Yingli Zhou: yinglizhou@link.cuhk.edu.cn Yuyang Xia: yuyangxia@link.cuhk.edu.cn
3
CSC3100 Data Structures Spring 2024
Programming Assignment 1
Due: Feb 7 2024 23:59:00
Assignment Link: http://oj.cuhk.edu.cn/contest/csc310024spa1
Access code: Waaagh
Question1 weighs 40% and question2 weighs 50%.
We extend the time limitation for Python from 1 second to 2 seconds.
1 Let us sort (40% of this assignment)
1.1 Description
Little X has a list A and a factor k. There are n positive integers in A. Little X wants to construct
some 2D points (xi
, yi) by assigning xi = ⌊
ai
k
⌋ and yi = ai%k, and he wants to sort these points in
several methods.
Method one, sort all points by the x-coordinates from smallest to largest, and for those with the same
x-coordinate, sort by the y-coordinates from smallest to largest.
Method two, sort all points by the x-coordinates from largest to smallest, and for those with the same
x-coordinate, sort by the y-coordinates from smallest to largest.
Method three,sort all points by the x-coordinates from smallest to largest, and for those with the same
x-coordinate, sort by the y-coordinates from largest to smallest.
Method four, sort all points by the x-coordinates from largest to smallest, and for those with the same
x-coordinate, sort by the y-coordinates from largest to smallest.
1.2 Input
Each test contains multiple test cases. The first line contains a single integer T(1 ≤ T ≤ 10) the
number of test cases. The description of the test cases follows.
The first line of each test case contains three integers n, k, id(1 ≤ n, k ≤ 105
, 1 ≤ id ≤ 4), separating
by one space, where n represents the length of the list and id represents the method Little X hopes
you to use.
The second line of each test case will be the list A (1 ≤ ai ≤ 109
).
The sum of n over all test cases in one test won’t exceed 5 × 105
.
1.3 Output
For each test case, output n lines, the ith line containing two integers xi
, yi
, separating by one space,
indicating the coordinate of the ith point of the constructed list sorted according to the given order.
The output of each test case is separated by one empty line.
4
Sample Input 1
4
2 65 1
7917 1292
1 41 1
6098
2 57 1
7920 4092
3 3 1
8596 1849 5806
Sample Output 1
19 57
121 52
148 30
71 45
138 54
616 1
1935 1
2865 1
There are four test cases in the example test, the first test case’s converted points list is [(121, 52),(19, 57)]
and Little X wants us to sort it according to the first method.
So the resulting list of the first test case is [(19, 57),(121, 52)]. The processes of the other test cases
are similar.
You can find more samples in the attached file on BB.
Problem Scale & Subtasks
There are 5 tests in total, with the same weight.
Test Case No. Constraints
1 1 ≤ n ≤ 5, id = 1.
2 1 ≤ n ≤ 100, 1 ≤ k ≤ 105
, 1 ≤ id ≤ 2
3 1 ≤ n ≤ 1000, 1 ≤ k ≤ 105
, 1 ≤ id ≤ 4
4 1 ≤ n ≤ 104
, 1 ≤ k ≤ 105
, 1 ≤ id ≤ 4
5 1 ≤ n ≤ 105
, 1 ≤ k ≤ 105
, 1 ≤ id ≤ 4
Hint
Try to define the relationship between the points by the requirement.
2 Detecting Tyranids (50% of this assignment)
2.1 Description
There is a galaxy map with n × m grids in it, and there are p Tyranid squads, each squad has k
Tyranids and is located in grid (i, j).
Suppose each grid (i, j) contains ki,j Tyranids. Now, as a commander of Space Marine, you want to
know the expected number of Tyranids in any rectangle on the map.
Formally speaking, you want to know the result of the following expression given the information of p
Tyranid squads.
Xn
a=1
Xm
b=1
Xn
c=a
Xm
d=b
Xc
i=a
X
d
j=b
ki,j
Note this number may be very large, you only need to output the remainder of the result mod
998244353.
5
2.2 Input
The first line contains 3 integers n, m, and p(1 ≤ n, m, p ≤ 105
).
For the following p lines, each line contains 3 integers i(1 ≤ i ≤ n), j(1 ≤ j ≤ m), and k(1 ≤ k ≤ 109
).
2.3 Output
One line contains one integer representing the remainder of the result mod 998244353.
Sample Input 1
4 3 1
2 1 1
Sample Output 1
18
For the first example, there is only one non-zero ki,j , k2,1 = 1.
Note that for n = 4, m = 3, there are 18 rectangles containing the grid (2, 1).
Figure 1: explanation of example 1
The orange portion has 6 grids and the blue area has 3, while 18 = 6 × 3.
Sample Input 2
5 5 5
3 4 2
4 5 6
4 4 2
2 3 1
3 4 3
Sample Output 2
800
For the second example, we can list every non-zero ki,j .
k2,3 = 1, k3,4 = 5, k4,4 = 2, k4,5 = 6. Then the target expression has a result of 800.
You can find more samples in the attached file on BB.
Problem Scale & Subtasks
There are 10 tests in total, with the same weight.
Test Case No. Constraints
1-3 1 ≤ n, m, p ≤ 10, 1 ≤ k ≤ 10
4-6 1 ≤ n, m, p ≤ 100, 1 ≤ k ≤ 100
7 1 ≤ n, m, p ≤ 105
, k = 1
8-10 1 ≤ n, m, p ≤ 105
, 1 ≤ k ≤ 109
6
Hint
For C/C++ and Java users, an int type stores integers range from -2,147,483,648 to 2,147,483,647. It
may be too small for this problem. You need other data types, such as long long for C/C++ and long
for Java. They store integers ranging from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
Use scanf("%lld",&n) for C, cin>>n for C++ and n = scanner.nextLong() for Java to get the
input n. And the other operations for long and long long are quite same as int.
Consider the number of grids containing one Tyranid, then consider how to combine all these numbers.
Remember to take modular after doing any arithmetic operations.
For instance, make sure for any a = b + c, you write it as a = (b + c) mod 998244353.
2.4 Extension
What if we want to calculate the variance?
7
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代做ceng0013 design of a pro...
2024-11-13
代做mech4880 refrigeration a...
2024-11-13
代做mcd1350: media studies a...
2024-11-13
代写fint b338f (autumn 2024)...
2024-11-13
代做engd3000 design of tunab...
2024-11-13
代做n1611 financial economet...
2024-11-13
代做econ 2331: economic and ...
2024-11-13
代做cs770/870 assignment 8代...
2024-11-13
代写amath 481/581 autumn qua...
2024-11-13
代做ccc8013 the process of s...
2024-11-13
代写csit040 – modern comput...
2024-11-13
代写econ 2070: introduc2on t...
2024-11-13
代写cct260, project 2 person...
2024-11-13
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!