牛津大學(xué)編程思維挑戰(zhàn)賽(The Oxford University Computing Challenge-OUCC)根據(jù)難度分為初級、中級、高級和精英級四個等級,分別對應(yīng)小學(xué),初中和高中。
該學(xué)術(shù)活動新賽季報名時間已公布,報名通道及學(xué)術(shù)活動真題開放中!
學(xué)術(shù)活動時間:
2022年5月8日14:00-15:00(60 分鐘)
Sorting Pairs
A set of pairs of integers needs sorting. There are n pairs in the set and the pairs need sorting in ascending order according to the sum of the pair of numbers.
Input format:
An integer,?n, indicating the number of pairs of numbers, followed by up to 20 lines of data, each line consisting of two integers.
Output format:
The sorted pairs of numbers, or the string?sorted?if the set of pairs is already sorted.
Example
Input:
5
0 10
4 10
1 10
3 10
2 10
Output:
0 10
1 10
2 10
3 10
4 10
Constraints:
All numbers are positive integers less than 100.
None of the input data in this task contains pairs of numbers whose sum is the same as any other pair in the same set.
Task:
Write a program that sorts a set of pairs of numbers in ascending order according to the sum of the pair of numbers.
Note: For Java (and similar) programs the grader expects the name of the main class to be: sortingpairs
知識點(diǎn):
list列表的應(yīng)用
tuple元組的應(yīng)用
dict字典的應(yīng)用
參考代碼:

想要獲取備賽計劃,考前查缺補(bǔ)漏、重點(diǎn)沖刺
歡迎前來掃描二維碼咨詢【免費(fèi)領(lǐng)取】歷年學(xué)術(shù)活動真題及解析!

以上就是關(guān)于【牛津大學(xué)編程挑戰(zhàn)賽(OUCC)-報名-真題2】的解答,如需了解學(xué)校/賽事/課程動態(tài),可至翰林教育官網(wǎng)獲取更多信息。
往期文章閱讀推薦:
??2027年QS最佳留學(xué)城市排名發(fā)布!倫敦位列第三,北美竟無緣Top10 ?
王虹、鄧煜!兩位中國數(shù)學(xué)家同獲菲爾茲獎!中國數(shù)學(xué)史新紀(jì)元!

? 2026. All Rights Reserved. 滬ICP備2023009024號-1